Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

NuGet "Gather Dependencies" Hangs

Tags:

nuget

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.

like image 653
Feasoron Avatar asked Nov 04 '15 13:11

Feasoron


3 Answers

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.

like image 171
Feasoron Avatar answered Nov 16 '22 17:11

Feasoron


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.

like image 41
Quinton Smith Avatar answered Nov 16 '22 17:11

Quinton Smith


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!

like image 2
neoscribe Avatar answered Nov 16 '22 17:11

neoscribe