In a particular project, I can't update or install any NuGet packages. When I try to do so using the NuGet GUI, it does some work and then stops without saying anything. When I try to do so using the package manager console, I get this output:
PM> Update-Package –reinstall EntityFramework
Attempting to gather dependencies information for multiple packages with respect to project 'SmartCentre', targeting '.NETFramework,Version=v4.5.2'
Update-Package : An item with the same key has already been added.
At line:1 char:15
+ Update-Package <<<< –reinstall EntityFramework
+ CategoryInfo : NotSpecified: (:) [Update-Package], Exception
+ FullyQualifiedErrorId : NuGetCmdletUnhandledException,NuGet.PackageManagement.PowerShellCmdlets.UpdatePackageCommand
packages
folderIt turned out that the packages.config
file had a couple of duplicates with different versions:
<?xml version="1.0" encoding="utf-8"?>
<packages>
<!-- ... -->
<package id="Microsoft.AspNet.Web.Optimization" version="1.0.0" targetFramework="net40" />
<package id="Microsoft.AspNet.Web.Optimization" version="1.1.2" targetFramework="net40" />
<!-- ... -->
<package id="Newtonsoft.Json" version="4.5.11" targetFramework="net40" />
<package id="Newtonsoft.Json" version="5.0.8" targetFramework="net40" />
<!-- ... -->
</packages>
Once I removed the duplicates, the problems stopped happening:
<?xml version="1.0" encoding="utf-8"?>
<packages>
<!-- ... -->
<package id="Microsoft.AspNet.Web.Optimization" version="1.1.2" targetFramework="net40" />
<!-- ... -->
<package id="Newtonsoft.Json" version="5.0.8" targetFramework="net40" />
<!-- ... -->
</packages>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With