Tip: Force-reinstall NuGet packages

Visual Studio Development General

6 years ago

NuGet is a great package manager, but sometimes it misbehaves and packages are either not properly downloaded or are not properly included in your project. Whenever you come across this, I recommend doing a force-reinstall of all packages. In Visual Studio go to Tools -> NuGet Package Manager -> Package Management Console . In the Package Manager Console window then enter the following command:

Update-Package -reinstall

This will go package by package and force-reinstall them the opened solution. If you want to force-reinstall packages only for one specific project instead of the whole solution, you can add the -ProjectName switch:

Update-Package -reinstall -ProjectName <yourproject>