5

I have seen this same problem brought up by numerous people online, and have tried just about everything under the sun to resolve this issue but nothing is working. I copied my visual studio solution to another location on my computer, and now when I try to build it I get the infamous...

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

Of course, I've enabled package restoration, tried restoring them manually (in which case I get a message saying "All packages are already installed and there is nothing to restore."), I've tried deleting all packages and then having the project restore them, I've read a lot about maybe the issue being the .csproj file, could that be it? If so, how do I access this file? Seems very rudimentary but for some reason I can't find it in my solution.

Casey Daly
  • 383
  • 8
  • 25
  • Does the new computer have the latest version of NuGet? Also, there have been some changes to the .csproj file format over the years, so it might be helpful to know which version of Visual Studio the project was created in, and whether it's .NET Core, .NET Standard, or .NET Framework. – Joe White Jul 02 '18 at 18:12
  • Any update for this issue? Have you resolved this issue? If not, would you please let me know the latest information about this issue? – Leo Liu Jul 05 '18 at 01:10
  • Yes, I did not end up figuring out why exactly this was happening, but I just decided to try copying my solution to a different location again and the second time it worked fine. As it is working fine now I am not looking further into what went wrong – Casey Daly Jul 09 '18 at 16:51

2 Answers2

2

Missing NuGet Packages, But “Packages Already Installed”

NuGet will check the packages directory for the solution when it restores.

It checks that this packages directory contains the .nupkg and manifest file for the NuGet package and if so it believes the NuGet package is already installed locally.

So, to resolve the issue "Missing NuGet Packages, But Packages Already Installed", you can try the following troubleshootings:

  1. Make sure you are not add the \packages folder in to source control, like TFS. If yes, please try to remove it out of source control.

  2. Make sure you are not change the .csproj file to another location. If yes, please edit the .csproj file and correcting the relative path to the solution folder.

  3. Remove the package folders and their contents from the packages directory, then try again.

If above not help, please try to share the restore log to us, I will check it and update my answer.

Hope this helps.

Leo Liu
  • 71,098
  • 10
  • 114
  • 135
  • I deleted the \packages folder. Successfully restored all NuGet packages with no apparent dependency issues. I unloaded all projects and checked all paths (all are relative). The solution builds without any issues on the machine where development began. Anyone who clones the solution from Azure DevOps to a difference machine cannot build. All projects report: This project references NuGet packages that are missing on this computer... Even after a successful Nuget-packages - restore. We are to the point of removing this from Azure and moving to a USB stick copy. – Doug Kimzey May 04 '21 at 12:56
2

The thread is quite old but for someone coming back. Make sure to delete the bin and object folder and rebuild the project.

user3104116
  • 153
  • 1
  • 11
  • 1
    This. I had already deleted the "bin" folder but the problem persisted. After deleting the "obj" folder the problem was gone. Turns out that "obj" contained a few NuGet related files that referred to an older version of a package that wasn't referenced by the project anymore. It's unfortunate that doing "clean solution" or "rebuild solution" has no effect on files created by NuGet. – HyperQuantum Sep 03 '21 at 10:31