Skip to content

Instantly share code, notes, and snippets.

@bcawrse
Last active September 6, 2019 21:20
Show Gist options
  • Save bcawrse/6ce732cc9051f28f2a51a170b18ade4b to your computer and use it in GitHub Desktop.
Save bcawrse/6ce732cc9051f28f2a51a170b18ade4b to your computer and use it in GitHub Desktop.
Simple details for Update-Package -Reinstall within Visual Studio for NuGet on .Net 4

Using Update-Package -Reinstall for NuGet

Tired of having to look this up everytime I need it, so saving it in a gist. Original SO answer

Note you can force package restore to execute by running the following commands in the nuget package manager console

Update-Package -Reinstall

Forces re-installation of everything in the solution.

Update-Package -Reinstall -ProjectName myProj

Forces re-installation of everything in the myProj project.

Note: This is the nuclear option. When using this command you may not get the same versions of the packages you have installed and that could be lead to issues. This is less likely to occur at a project level as opposed to the solution level. You can use the -safe commandline parameter option to constrain upgrades to newer versions with the same Major and Minor version component. This option was added later and resolves some of the issues mentioned in the comments.

Update-Package -Reinstall -Safe

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment