Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

An error occurred while retrieving package metadata for ***

Tags:

c#

package

nuget

This has been asked many times before. The solution (which works for me) is to delete the *** package(s) from the packages.config file (this is enough), and from the packages folder.

This is a bad solution for me because it has to be repeated every time I want to install some nuget package. The culprit package varies, but it tends to be the same package(s) every time (Newtonsoft.Json/NETStandard.Library etc...), until I delete all packages and try to reinstall them (this sometimes changes the culprit package).

Is there a solution for this? It is nerve-wrecking to have to do this manual fix all the time. And I think it points to some major underlying problem that I would like to amend in my project.

like image 349
maxx Avatar asked Jul 14 '17 12:07

maxx


4 Answers

Update the Visual Studio Package Manager to the latest version using the below steps and the ongoing issue will disappear.

  1. In Visual Studio, from the "Tools" menu choose the "Extensions and Updates" option.
  2. From the dialog that appears, expand the "Updates" node from the tree at the left side.
  3. Select the "Visual Studio Gallery" option from the tree.
  4. Finally, look for the Package Manager update in the list of updates at the right side of the dialog and click the "Update" button beside it.
like image 57
SF1Dev Avatar answered Nov 17 '22 21:11

SF1Dev


I had the same issue with my visual studio 2015.

But Uninstalling the Nuget Package Manager and re-installing the same worked for me.

In Visual Studio, from the "Tools" menu choose the "Extensions and Updates" option. Top right "Search Installed" bar, sear ch for Nuget Package Manager Uninstall the Nuget Package Manager for Visual Studio 2015. Restart Visual Studio. Re-Install the same with the same steps.

close the visual studio and again open

like image 21
Gauri Avatar answered Nov 17 '22 23:11

Gauri


I had the same issue with my visual studio 2015.

But Uninstalling the Nuget Package Manager and re-installing the same worked for me.

  1. In Visual Studio, from the "Tools" menu choose the "Extensions and Updates" option.
  2. Top right "Search Installed" bar, sear ch for Nuget Package Manager
  3. Uninstall the Nuget Package Manager for Visual Studio 2015.
  4. Restart Visual Studio.
  5. Re-Install the same with the same steps.
like image 2
Rachit Avatar answered Nov 17 '22 21:11

Rachit


What worked for me in VS2022-

  • Tools -> NuGet Package Manager -> Package Manager Settings
  • Here click "Clear all NuGet Cashe".
  • Restart VS.

Should be ok now.

like image 1
Vladimir Pavlov Avatar answered Nov 17 '22 22:11

Vladimir Pavlov