Reputation: 19770
I'm getting the following error in NuGet while trying to install package Microsoft.AspNet.Server.IIS
Attempting to resolve dependency 'Microsoft.AspNet.Loader.IIS.Interop (≥ 1.0.0-alpha4-10330)'.
Attempting to resolve dependency 'Microsoft.AspNet.Loader.IIS (≥ 1.0.0-alpha4-10330)'.
'Microsoft.AspNet.Loader.IIS' already has a dependency defined for 'Microsoft.AspNet.FeatureModel'.
How to resolve it?
UPDATE: Also, I'm getting the following:
Attempting to resolve dependency 'Microsoft.Framework.DependencyInjection (≥ 1.0.0-alpha4-10326)'.
'Microsoft.Framework.DependencyInjection' already has a dependency defined for 'Microsoft.Framework.ConfigurationModel'.
Upvotes: 101
Views: 149423
Reputation: 191
In a project using vs 2010, I was only able to solve the problem by installing an older version of the package that I needed via Package Manager Console.
This command worked:
PM> Install-Package EPPlus -Version 4.5.3.1
This command did not work:
PM> Install-Package EPPlus -Version 4.5.3.2
Upvotes: 0
Reputation: 21
Upvotes: 2
Reputation: 101
I was getting this issue on our TeamCity build server. I tried updating NuGet on the build server (via TC) but that didn't work. I finally resolved the problem by changing the "Update Mode" of the Nuget Installer build step from solution file to packages.config
.
Upvotes: 5
Reputation: 325
I tried the update, but it did not work for me. Helped:
Upvotes: 20
Reputation: 1374
I fixed a similar issue in my solution by:
nuget update -self
This upgraded the copy of NuGet.exe
that was in my solution from 2.8.0
to 3.4.4
, which fixed the 'X' already has a dependency defined for 'Y' error that was stopping it from downloading SSH.NET automatically before building.
(If your solution doesn't have a copy of NuGet.exe
in it - and it might not - then you should try the solution in TN's answer instead)
Upvotes: 76
Reputation: 19770
This was resolved by installing the latest NuGet Package Manager:
https://visualstudiogallery.msdn.microsoft.com/4ec1526c-4a8c-4a84-b702-b21a8f5293ca
Don't forget to restart Visual Studio.
Upvotes: 157
Reputation: 1
Done.
Upvotes: 0
Reputation: 2282
I faced this error on outdated version of Visual Studio 2010. Due to project configuration I was not able to update this version to newer. Therefore, update of NuGet advised above did not fix things for me.
Root reason for the error in this and similar situations is in dependencies of the package you try to install, which are not compatible with .NET version available in your project.
Universal solution is not obligatory update of Visual Studio or .NET but in installation of older NuGet versions of the same package compatible with your system.
It is not possible to tell for sure, which of earlier versions will work. In my case, this command installed the package without any NuGet updates.
Install-Package X -Version [compatible version number]
Upvotes: 9
Reputation: 61
In my case I had to delete the file NuGet.exe in the Project folder/.nuget and rebuild the project.
I also have in NuGet.targets the DownloadNuGetExe marked as true:
<DownloadNuGetExe Condition=" '$(DownloadNuGetExe)' == '' ">true</DownloadNuGetExe>
Hope it's helps.
Upvotes: 1
Reputation: 41
I was getting the issue 'Newtonsoft.Json' already has a dependency defined for 'Microsoft.CSharp'
on the TeamCity build server.
I changed the "Update Mode" of the Nuget Installer build step from solution file to packages.config and NuGet.exe to the latest version (I had 3.5.0) and it worked !!
Upvotes: 4
Reputation: 9
The only solution that worked for me was to uninstall nuget completely from Visual Studio 2013 and then install it again with the obligatory restart of VS in between.
Upvotes: 0