How to fix NuGet packages when upgrading .NET Framework

If you find yourself in the middle of upgrading the .NET Framework on your project, you may have encountered some errors letting you know that the project's associated NuGet packages need to be re-installed.

Have no fear, you are almost done with your upgrade. Long gone are the days of having to manually go through your entire project uninstalling the packages yourself. With NuGet 2.1+, this becomes trivial.

In Package Manager (View -> Other Windows -> Package Manager) type:

update-package -reinstall

This command will uninstall all NuGet packages in your entire solution and re-install them targeting the correct .NET framework.

Happy solution upgrading.