Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can't install any NuGet Package if at least one Source is not available

The following problem does not exist in VS2013 (Premium),I can only reproduce it in VS2015 (Enterprise)

I've added a custom NuGet package source. If that source if not available I cannot install any package (for example EntityFramework)

I get a message

Attempting to gather dependency information for package 'EntityFramework.6.1.3' with respect to project 'ConsoleApplication9', targeting '.NETFramework,Version=v4.5.2'

Exception'System.AggregateException' thrown when trying to add source 'http://XXX/FeedService.svc/'.

Please verify all your online package sources are available.

From the last line of the message I assume that this is not a bug but as I said it works on VS2013

Any idea why this has changed?
Can I do anything about this?

like image 550
George Vovos Avatar asked Jun 15 '16 09:06

George Vovos


2 Answers

This is by design. Since we support searching across multiple sources for the packages that you need, we need to be able to reach all sources and get the package results before restoring these packages, to be deterministic and consistent in the way we do restore.

However, we understand that some users go into offline/online modes and we are investing in building a feature set that will enable you to temporarily disable some sources while you are working offline. In the meantime you can look into creating a custom nuget.config that does not contain the offending source and using that to restore when you are in the offline mode.

like image 99
Harikrishna Menon A Avatar answered Oct 20 '22 00:10

Harikrishna Menon A


This is an old question so I'm surprised the workaround from the bug report wasn't added here. To save reader a click:

  1. From within Visual Studio, open Tools -> Options -> NuGet Package Manager -> Package Sources
  2. Untick all of the package sources that are unavailable, leaving just the public NuGet entries. NuGetExample
  3. Install your packages as normal

Once you're back in your office follow steps 1 and 2 again but this time make sure everything is checked.

like image 32
Malice Avatar answered Oct 19 '22 23:10

Malice