NuGet has problems with missing packages, how to recover them?

When I try to compile my program, I get the following error:

This project references NuGet package(s) that are missing on this computer. Enable NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=317567. 

Now when I right click on the solution and click

 All packages are already installed and there is nothing to restore. 

I tried manually reinstalling every package that didn't solve the problem, I tried reinstalling NuGet, but that didn't help, and I even tried reinstalling visual studio.

I also tried moving the package folder from the tfs folder to overwrite my package folder, but that didn't solve anything. I also tried reinstalling them with the lack of this package, which also did not resolve the problem.

Does anyone know how to repair nuget packages?

+6
source share
4 answers

Use the Package Manager Console in Visual Studio to run this command.

1.This will restore all packages from the solution.

 nuget restore YourSolution.sln 

2. If you want to reinstall packages in the same versions that were installed previously

 Update-Package -reinstall 
+9
source

It is probably a good idea to clear the Nuget cache by deleting the contents in this directory: C:\Users\{your_username}\AppData\Local\NuGet

0
source

Well, probably this is bad, but I found that it works if I just delete the line

http://go.microsoft.com/fwlink/?LinkID=317567. "HelpKeyword =" BCLBUILD2001 "/">

from project.csproj, not sure if this will cause problems later, but now it works.

0
source

Honestly, the one who developed the NuGet team for VS should go back to the drawing board. They generally missed the fact that sometimes these DLLs and / or files get corrupted or deleted. the NuGet Get-Packages -Force variant will really save their bacon. The only GAP I see is that VS and the Package console do not allow you to force download from NuGet. Even clearing the cache through VS is useless.

0
source

All Articles