Visual Studio 2015, Nuget and “same key has alread

2019-04-29 17:40发布

问题:

I have Visual Studio 2015 RC. When I open a console app or a Windows Phone 8 Silverlight project, everything works fine, I can use Nuget without problems.

When I open a Universal App project (Windows 8.1 + Windows Phone 8.1), Nuget breaks. When I open the Nuget console, I see

When I try to install a Nuget package using the Nuget GUI, I get the same error.

One more strange thing. When I open VS2015 RC without any projects and open the Nuget console, I do not get the error. Then when I open my Universal App project, the error appears.

I am pretty sure it is connected to the Universal App project.

I testes the Universal App project in VS2013 and everything works fine there, no problems with Nuget.

I tried all the steps in installing nuget package "same key has already been added." but it did not help. I guess it is because another folder may be corrupted in my case.

Happens to me on two separate machines, both run Windows 8.1 Pro, one has only VS2015 RC and on has both VS2013 Pro and VS2015 Pro.

回答1:

I have had the same problem with VS2013 from time to time. While I don't have the exact steps to resolve here, the following summarizes what worked (it may be over kill).

  1. use the package manager to remove all packages
  2. remove the library binding section in the app config
  3. re-add the packages via the package manager

It is a windows machine, you may need to restart visual studio between each step.