C# – Source unreachable when using the NuGet Package Manager Console

cinstallationnugetvisual-studio-2013

We are moving our package management from manually updating files to NuGet. I am trying to install older versions of packages to match the one we already have in source control. There is no way to do this from the UI so I use the command line to get the proper version.

For some reason, Install-Package keeps on telling me that the nuget gallery is unreachable.

The source at nuget.org [https://www.nuget.org/api/v2/] is unreachable. Falling back to NuGet Local Cache

This happens only in one of our solutions. If I create a new solution or use another one in the same repository, packages will install as expected. I can even install the packages in a dummy solution to fill the local cache and then install them successfully in the faulty solution. I have tried to Invoke-WebRequest on the url from the NuGet Console and I get an HTTP 200.

What can cause this? Is there a way to override the package sources on a per solution/project basis?

Best Answer

Even though my Package Source was set to nuget.org in Package Manager Console, explicitly adding the -Source nuget.org argument fixed this for me.

So an example of use would be:

Install-Package Akka.net -Source nuget.org

Akka.net being your package that you want to install, its just an example here.