Nuget Update-Package command extremely slow

15,440

Solution 1

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.

Solution 2

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.

Solution 3

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.

Solution 4

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.

Share:
15,440

Related videos on Youtube

Andre Lombaard
Author by

Andre Lombaard

Updated on July 13, 2022

Comments

  • Andre Lombaard
    Andre Lombaard almost 2 years

    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?

    • CodeCaster
      CodeCaster over 8 years
      "Is there any reason why TFS might [...] be slow?" - because it's a centralized version control system, using HTTP, that runs on IIS and SQL Server? ;) Yeah just kidding, this very site does the same. See github.com/NuGet/Home/issues/418 for example, are your packages under version control?
    • Andre Lombaard
      Andre Lombaard over 8 years
      @CodeCaster My packages should not be under version control, but will have a quick look, one of the developers might have accidentally added the packages folder
    • Andre Lombaard
      Andre Lombaard over 8 years
      @CodeCaster, the packages folder were added to source control. The process is still quite slow but I logged an issue with Nuget. They came back and confirmed that the process is a lot slower in the new version and that they are looking into the problem. Please add your comment as an answer and I will gladly mark it as the correct one.
  • Hüseyin Yağlı
    Hüseyin Yağlı about 8 years
    Thank you very much. You just saved me from a hell of waiting.
  • crimbo
    crimbo about 8 years
    VS 2015 update-package runs quite slow for non-trivial projects, and packages are not checked in. There's a ton of network activity even for single package updates. Hopefully the fix for this issue will address that.
  • Sam Shiles
    Sam Shiles almost 8 years
    I have also just tested with the latest package manager update: 3.4.4 and can confirm update-package is now much faster