NuGet: 'X' already has a dependency defined for 'Y'

后端 未结 11 1005
终归单人心
终归单人心 2020-11-28 07:40

I\'m getting the following error in NuGet while trying to install package Microsoft.AspNet.Server.IIS

Attempting to resolve dependency \'Microso         


        
相关标签:
11条回答
  • 2020-11-28 08:17

    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 !!

    0 讨论(0)
  • 2020-11-28 08:19

    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.

    0 讨论(0)
  • 2020-11-28 08:21

    I tried the update, but it did not work for me. Helped:

    1. Uninstall NuGet => Tools => Extensions and update => Installed
    2. Install NuGet
    3. Reload Visual Studio
    0 讨论(0)
  • 2020-11-28 08:22

    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.

    0 讨论(0)
  • 2020-11-28 08:27

    I fixed a similar issue in my solution by:

    1. Opening up a command prompt
    2. Navigating to the .nuget folder in my solution
    3. Running 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)

    0 讨论(0)
  • 2020-11-28 08:30

    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.

    0 讨论(0)
提交回复
热议问题