Reinstalling All NuGet Packages in a Solution

I just did a fresh install of Windows 10 and Visual Studio 2015. When I pulled down my projects from TFS Online and opened several VS solutions, however, many references were missing from the projects and nothing would build. It turns out that NuGet packages are referenced relative to the solution and not the individual projects. If you have a library that you want to share across multiple solutions and you add that library to a new solution, the NuGet packages for that shared project will have to be set up again for the new solution because the path to the "packages" folder will have changed due to the new, relative path of the new solution.

To get things going again, I ran the following command from the Package Manager Console:

Update-Package -Reinstall

That uninstalled and then reinstalled every package in the solution.

You can also target a specific project in the solution if you want:

Update-Package -Project "My.Project.Name" -Reinstall

I hope that helps!

Posted on 8/4/2015 at 03:08 PM , Edited on 8/11/2015 at 01:08 AM


Leave a comment