nuget restore causing build failures 50% of the time

chris's Avatar


23 Jul, 2015 02:36 PM

Over the last few days, I've been getting consistent build failures during nuget restore. Most of my plans will build Debug and Releases configurations in parallel, which has been working very well for a while now until the last few day. Now I'm seeing results that will have Release complete bug debug fail, of vice versa. Here is a typical example of what i'm seeing in the build logs:

WARNING: Unable to connect to the remote server
WARNING: Unable to connect to the remote server
Unable to find version '2.1.0' of package 'Microsoft.Owin.Security'.
Unable to find version '2.1.0' of package 'Microsoft.Owin.Security.OAuth'.
Command exited with code 1

I'm using a standard restore command passing in the public feed and my own private feed hosted at issues until now.

nuget restore src/MySolution.sln -Source ";"
  1. Support Staff 1 Posted by Feodor Fitsner on 23 Jul, 2015 04:18 PM

    Feodor Fitsner's Avatar

    Unfortunately, hiccups are happening from time to time. I recommend setting up build cache for nuget packages to minimize that dependency:

  2. 2 Posted by chris on 23 Jul, 2015 04:39 PM

    chris's Avatar

    I swear I checked the docs first :) .perfect, thank you.

  3. 3 Posted by chris on 23 Jul, 2015 09:54 PM

    chris's Avatar

    Just a followup, I've added the recommended setting to my cache setting, however my sln resides in a src subdirectory...I've tried a few variations, but it seems it will still only look for a packages folder in the repo root. here is what I've tried with no luck:

    packages -> **\**\packages.config
    packages -> src\**\packages.config

    results in Cache entry not found: C:\projects\repo\packages

  4. Support Staff 4 Posted by Feodor Fitsner on 23 Jul, 2015 11:24 PM

    Feodor Fitsner's Avatar

    Yeah, path is on the left and invalidation trigger (dependency) is on the right. If sln in src directory then try this:

    src\packages -> **\packages.config
  5. 5 Posted by Richard on 24 Jul, 2015 09:21 AM

    Richard's Avatar

    Is there a way to configure nuget build caches without using .yml files? We don't use them, we only use the GUI (and need to keep it that way really).

  6. 6 Posted by chris on 24 Jul, 2015 02:41 PM

    chris's Avatar

    @Richard Yes, i'm not using can add this right in the interface on the Environment tab of your plan settings. You'll see Cached directories and files, just add one or more of the entries discussed above.

    @Feodor that worked, thank you!

  7. 7 Posted by Richard on 29 Jul, 2015 09:06 AM

    Richard's Avatar

    Hmm, that's interesting. Will that permanently cache though? What if the nuget packages in there are updated, will it handle that appropriately? Or will I need to do something whenever that happens?

  8. Support Staff 8 Posted by Feodor Fitsner on 29 Jul, 2015 06:45 PM

    Feodor Fitsner's Avatar

    The cache is not guaranteed to be permanent. Packages of specific versions that already cached won't be changed - they are immutable on Also, cache will be invalidated (and thus packages re-fetched from when any of packages.config changes.

  9. chris closed this discussion on 31 Jul, 2015 07:18 PM.

Comments are currently closed for this discussion. You can start a new one.

Keyboard shortcuts


? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac