Andre Lombaard
Andre Lombaard

Reputation: 7105

Nuget Update-Package command extremely slow

I have a Visual Studio 2015 solution where I want to update all my Nuget packages by making use of the Update-Package command. The solution contains 38 projects, I can see from the Package Manager console that the packages are being updated, but the process is extremely slow, it's been running for over 4 hours now.

I previously had a problem on a smaller project where the update was slow and eventually had to remove the project from TFS, update the packages then add it back to source control. Is there any reason why TFS might cause a Nuget-Package update to be slow?

Upvotes: 25

Views: 16673

Answers (5)

gawkface
gawkface

Reputation: 2322

Also worth leveraging the package source config to unselect global package sources if one only wants to (temporarily) update internal/organizational pacakges : https://learn.microsoft.com/en-us/nuget/consume-packages/install-use-packages-visual-studio#package-sources

I tried re-oreding the package sources (starting from local down to global/bigger) - though the order wasnt maintained for me and I gave up, didn't measure if this made any difference

Upvotes: 0

CaptainMuffin
CaptainMuffin

Reputation: 23

Download v3.6.0 of the Nuget Package Manager from https://www.nuget.org/downloads for VS2015.

I had v3.4.4 installed and it was taking 2+ hours to update packages in a solution, now it is back to taking a couple of minutes.

In the extensions and updates inside VS2015 searching for NuGet Package Manager online does not show anything above v3.4.4, which is super frustrating when a fix is available.

Upvotes: 1

Jakub Januszkiewicz
Jakub Januszkiewicz

Reputation: 4418

Packages folder being under source control aside, the updates are still extremely lengthy. Looking at NuGetGallery GitHub issue 2637, this will be fixed in nuget 3.4. I'm testing the 3.4.0-rc version now and so far it makes a huge difference, so fingers crossed.

Upvotes: 5

Andre Lombaard
Andre Lombaard

Reputation: 7105

To elaborate on CodeCatser's answer,

  • Make sure that the packages folder is not added to source control
  • Make sure that you do not include any unnecessary files within the node when creating you own Nuget packages (This will add the files to your package, affecting the size). We added a lot of files that could have been referenced by installing dependent packages
  • Set the -IgnoreDependencies (When there are no dependencies) and -Source flags when running the Update-Package command

By taking care of steps mentioned above you can greatly improve the speed of your package updates. We improved the speeds from 4 hours to 25 minutes to 9 minutes.

Upvotes: 4

CodeCaster
CodeCaster

Reputation: 151710

As explained in this NuGet issue on GitHub (and in yours), updating packages that are under source control can take excruciatingly long.

Just unversion the packages to speed the process up.

Be sure to store the packages somewhere in your network though, I still don't rely on NuGet hosting these packages forever.

Upvotes: 4

Related Questions