Post

Reinstall NuGet Packages without Updating

How to force a reinstall of NuGet packages in a .NET project without upgrading them to newer versions — useful when retargeting to a newer .NET Framework.

When retargeting a .NET Framework project to a newer version (e.g., from 4.6.1 to 4.7.2), Visual Studio may mark certain packages for reinstallation. This shows up as requireReinstallation="true" in packages.config:

<package id="System.Security.Cryptography.Algorithms" version="4.3.0" targetFramework="net461" requireReinstallation="true" />

Rather than removing and reinstalling packages one by one through the GUI, use the Package Manager Console.

Reinstall All Packages (Solution-Wide)

Update-Package -reinstall

Reinstall for a Specific Project

Update-Package -reinstall -Project ProjectName

Replace ProjectName with the name of your project as it appears in Solution Explorer.

This is dramatically faster than the manual GUI approach, especially when dealing with multiple packages or multiple retargeted projects. The -reinstall flag ensures packages are reinstalled at their current version rather than upgraded.

← Back to all posts