27

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.

Camilo Terevinto
  • 31,141
  • 6
  • 88
  • 120
maxx
  • 463
  • 1
  • 4
  • 12

5 Answers5

62

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.
SF1Dev
  • 790
  • 7
  • 11
  • Did not fix it for me unfortunately. I solved the issue by commenting the v3 source from nuget configuration file. – maxx Jul 24 '17 at 14:47
  • I don't find update, is there way to uninstall and reinstall Nuget package manager again? – M.kazem Akhgary Sep 24 '17 at 15:08
  • Since the Nuget package manager is a Visual Studio extension, you should be able to remove it and then reinstall it in the same way you would other extensions. You can read about it here: [How to: Add or Remove Extensions](https://msdn.microsoft.com/en-us/library/ff852054(v=vs.110).aspx) – SF1Dev Sep 24 '17 at 15:52
  • 4
    I am on latest version, tried to uninstall / reinstall. Problem persists. For me it's complaining about xunit.abstractions. --- I restarted VS a second time and it suddenly, gloriously, inexplicably started working. FML – jgitter Aug 17 '18 at 21:55
2

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.
Rachit
  • 39
  • 1
  • 6
  • try to highlight the keywords and be clear with the format it will help to reach out your answer for others – Agilanbu Dec 21 '18 at 06:22
2

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

Gauri
  • 21
  • 1
  • On VS 2015 it's not possible to update, but this answer worked perfectly. Thx. Plus one. – Yster Jul 31 '20 at 12:35
1

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.

0

Changing the desired version to be fetched in packages.config did the trick. If you'll relaunch Visual Studio then you'll see in the Manage NuGet Packages... that the dependency is updated. It didn't require from me to do it twice - this dependency has been updated based on the PackageReference of this NuGet https://www.nuget.org/packages/System.Net.Http/

isherwood
  • 58,414
  • 16
  • 114
  • 157
Daniel Danielecki
  • 8,508
  • 6
  • 68
  • 94