6
votes

I have Visual Studio Enterprise 2015 with Update 3. Recently, NuGet package manager stopped finding any package except the set of offline packages: Microsoft Visual Studio Offline Packages.

I tried opening different projects, restarting visual studio and went to the extent of repairing/upgrading Visual Studio.

I also tried all the methods in this question: VS2015 nuget package manager not finding packages.
Nothing worked.

When I try searching/upgrading packages from Visual Studio NuGet UI, the Loading or Searching progress ring appears, but nothing is loaded. Task Manager and Firewall suggests that no connection is made.

Finally, this appears:

[nuget.org] Unable to load the service index for source http://api.nuget.org/v3/index.json.

An error occurred while sending the request. Unable to connect to the remote server A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond

I might be missing something obvious. What am I doing wrong? Any help is appreciated.

1

1 Answers

6
votes

Finally, I solved the problem myself. Posting the answer here in case if anyone faces the same issue in the future.

As suggested by the error message, this was a connection issue. Apparently, NuGet uses the environment variable for proxy http_proxy even if the proxy settings are disabled in Windows settings. I removed the environment variable and it fixed the issue.

In fact, the error was documented here: https://github.com/NuGet/Home/issues/2880

Finally I found the issue, at least in my case: if no Windows HTTP proxy is specified, NuGet uses (if present) the HTTP Proxy specified in the environment variable http_proxy.

Although, I had the http_proxy set even before, NuGet worked fine. So, an update should have triggered the issue.

Thanks anyone who viewed the question.