1

In VS 2017 on up to date Windows10 I have Nuget Package Manager 4.6 installed. I just cleared all my nuget caches and now if I try to add a Nuget to any project, or a build a project that has nuget dependencies, I get download errors.

e.g.

Resolving actions to install package 'Newtonsoft.Json.12.0.3'
Resolved actions to install package 'Newtonsoft.Json.12.0.3'
Retrieving package 'Newtonsoft.Json 12.0.3' from 'nuget.org'.
  GET https://api.nuget.org/v3-flatcontainer/newtonsoft.json/12.0.3/newtonsoft.json.12.0.3.nupkg
  OK https://api.nuget.org/v3-flatcontainer/newtonsoft.json/12.0.3/newtonsoft.json.12.0.3.nupkg 28ms
Installing Newtonsoft.Json 12.0.3.
Error downloading 'Newtonsoft.Json.12.0.3' from 'https://api.nuget.org/v3-flatcontainer/newtonsoft.json/12.0.3/newtonsoft.json.12.0.3.nupkg'.

I cannot see any issues with Nuget.org in my browser on the same machine and now I basically cannot build anything! What could be the problem?

Mr. Boy
  • 60,845
  • 93
  • 320
  • 589
  • which windows? nuget turned off TLS1.0/1.1 support. you need TLS 1.2 support: https://devblogs.microsoft.com/nuget/deprecating-tls-1-0-and-1-1-on-nuget-org/ – magicandre1981 Jul 01 '20 at 13:54
  • W10. I'm using the package manager not Powershell though, so I read this as it should work... also it worked earlier today. Clearing the cache caused the problem. – Mr. Boy Jul 01 '20 at 13:57
  • Aha, seems to be this issue: https://stackoverflow.com/questions/10582001/nuget-exe-pack-gives-access-to-the-path-is-denied – Mr. Boy Jul 01 '20 at 14:06
  • Can you access `nuget.org` under Nuget Package Manager UI? – Mr Qian Jul 02 '20 at 07:17
  • 1
    I found that you use `https://api.nuget.org/v3-flatcontainer/.........` as `nuget.org` path, please try to use this: `https://www.nuget.org/api/v2/` as nuget.org. – Mr Qian Jul 02 '20 at 07:31

1 Answers1

3

After clearing Nuget caches, every Nuget install fails

You could try the following steps to troubleshoot your issue:

Suggestions

1) close VS Instance, delete C:\Users\xxx(current user account)\AppData\Roaming\NuGet\NuGet.Config

Also, enter your project path, try to delete .vs hidden folder of your solution folder, bin and obj folder. And then restart VS.

2) try to set your nuget.org with http://packages.nuget.org/v1/FeedService.svc/or https://www.nuget.org/api/v2/.

under Tools-->Options-->Nuget Package Manager-->Package Sources to test again.

enter image description here

Make sure that your current agent Internet can access these paths.

3) run [Net.ServicePointManager]::SecurityProtocol=[Net.ServicePointManager]::SecurityProtocol-bOR [Net.SecurityProtocolType]::Tls12 under Tools-->Nuget Package Manager--> Package Manager Console and then install the package to test again.

4) check if there is a firewall policy or other proxy settings that block the nuget installation package.

5) try to disable any third party extensions under Tools--> Extensions and Updates in case some extensions interface it.

6) If your VS has any update, please update it.

Mr Qian
  • 21,064
  • 1
  • 31
  • 41
  • suggestion 2 worked to solve my issue with `Install-Package : Failed to retrieve information about 'Newtonsoft.Json' from remote source: 'https://www.nuget.org/FindPackagesById()?id='Newtonsoft.Json'&semVerLevel=2.0.0'` – Mark Davich Jul 13 '21 at 20:53