NuGet "Gather Dependencies" Hangs

Nuget

Nuget Problem Overview


When I add a NuGet package (latest version of NuGet and Visual Studio 2015) it hangs at "Attempting to gather dependencies" for ~5 minutes before installing the package. I can point to NuGet.org, our internal server, or a folder on my local machine. All behave exactly the same.

Nuget Solutions


Solution 1 - Nuget

After a lot of digging (I had this issue for a long time before posting) I found the issue. One of the NuGet package sources in my list was down. If I remove that from the list, everything goes smoothly. With it in, it bogs down even if no packages in my packages.config are related to that source.

Solution 2 - Nuget

I struggled with the same issue for too long and almost all the advice I read was to update nuget VS extension (I'm using VS package manager console) or restart VS and nothing worked...

My setup (at time of issue):

  • VS 2015 Pro Update 2
  • Package Manager Console Host Version 3.4.3.855

Solution that finally worked for me:

  1. Close VS if open.
  2. Delete %AppData%\NuGet\NuGet.Config
  3. Open VS and package manager console (this will recreate Nuget.config)

This updated my nuget.org feed to no longer point to www.nuget.org/api/v2 (see image below)

New nuget.org feed

  1. My Microsoft and .NET feed was also selected and I had to deselect that too: enter image description here

After this installing packages no longer hung on 'Attempting to gather dependency information for package...'

Kudos to https://stackoverflow.com/a/36461793/4977243 for the idea of deleting nuget.config.

Solution 3 - Nuget

This morning, all of our builds started failing. After doing some digging, we figured out that it was hanging on https://www.nuget.org/api/v2 while resolving dependencies. More digging, it was connecting and downloading but seemed to be caught in a loop. Each time we cancelled the build, it left a Nuget.exe running in the background - CPU got hot.

Turns out that nuget.org upgraded their servers last night (1/13/2016) and the version of Nuget.exe that our builds were running (2.7.2) was choking.

The fix (at least for us) was to upgrade to 2.8.6 (https://dist.nuget.org/win-x86-commandline/v2.8.6/nuget.exe). I know that isn't the most current version but it worked for us. We'll upgrade later after the smoke dissipates!

Solution 4 - Nuget

  1. Please go to the location of Nuget.config in Windows machine (of user) %appdata%\NuGet.
  2. Here you can remove the key(s) of the incorrect package's location(s)/link(s).
  3. Now try the same command in SHELL to download package.

Solution 5 - Nuget

For me, it has always been a wrongly configured proxy issue. When the error says: "Gathering dependencies....", its usually trying to download some package.

If all the nuget configurations are right, please do check the system proxy.

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionFeasoronView Question on Stackoverflow
Solution 1 - NugetFeasoronView Answer on Stackoverflow
Solution 2 - NugetQuinton SmithView Answer on Stackoverflow
Solution 3 - NugetneoscribeView Answer on Stackoverflow
Solution 4 - NugetSuriyaView Answer on Stackoverflow
Solution 5 - NugetGopesh BharadwajView Answer on Stackoverflow