Reinstalling all NuGet Packages in a Solution

After updating a simple MVC application I got this error in Visual Studio:

The type or namespace name ‘Mvc’ does not exist in the namespace ‘System.Web’ (are you missing an assembly reference?)

This can happen when you update your project to a different version of the .Net framework. You can now manually update or reinstall the package mentioned in the error message. Most likely this error will reappear with another package. Followed by yet another one.

A faster way is to open the package manager console and use this command:

Update-Package -safe -reinstall -IgnoreDependencies

This command reinstalls all packages at once, what also includes packages that are still working. This unnecessary work will still be done faster than when you manually reinstall only the no longer working packages.

4 thoughts on “Reinstalling all NuGet Packages in a Solution”

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.