nugetnuget-package-restore

Nuget restores of Microsoft packages are taking extremely long to install


We've been having problems with nuget restores of Microsoft packages on our build server taking an extremely long time. As an example, Microsoft.Extensions.Configuration took 3 minutes to get "added":

[10:16:07] : [restore] Restoring NuGet package Microsoft.Extensions.Configuration.9.0.0.
[10:16:07] : [restore] Adding package 'Microsoft.Extensions.Configuration.9.0.0' to folder 'xxx'
[10:19:38] : [restore] Added package 'Microsoft.Extensions.Configuration.9.0.0' to folder 'xxx'

Whereas a locally developed package took milliseconds as expected (I've hidden the package name):

[10:16:07] : [restore] Restoring NuGet package XYZ.
[10:16:07] : [restore] Adding package 'XYZ' to folder 'xxx'
[10:16:07] : [restore] Added package 'XYZ' to folder 'xxx'

We're seeing this with virtually all Microsoft packages, the result being that a nuget restore with many packages that should take a minute takes almost 20.

Does anyone have any insight into whats happening here? My understanding is that this is basically just an extration of the zip and a local file copy. How could it take so long and why would it be isolated to only these packages?

Some additional information:

Any insight or ideas are appreciated. We have builds that take 2 minutes one day and 20+ the next!


Solution

  • maybe a certificate check or revokation

    This is correct. nuget.org adds a repository signature to all packages uploaded to it, all packages, coming from nuget.org or not, may also have author signatures. NuGet does signed package verification on all signed packages, including cert revocation checks.

    You can set the NUGET_CERT_REVOCATION_MODE environment variable to offline to disable the revocation checks and take the (small) increased risk of a compromised certificate having signed a package you're using.