4

How can I upgrade a NuGet package to a specific version.

This is similar to Download old version of package with nuget, except I already have a version of the given nuget package installed.

I can't update to the latest version, so I want to update to a specific one.

Do I need to uninstall and than re-install or can I upgrade in one step?

Community
  • 1
  • 1
Philip Pittle
  • 11,821
  • 8
  • 59
  • 123
  • For me uninstall + install specific version has worked. I think only way you can have problems is if you messed up config. In that case just recreate the project. With just clean install. – Margus Nov 17 '14 at 12:47
  • I'd prefer not to `recreate the project` just to update a reference though. – Philip Pittle Nov 17 '14 at 13:26

1 Answers1

6

So I think you need to run the Update-Package command by setting the Version flag.

For example:

Update-Package Newtonsoft.Json -Version 6.0.4

Here's the full command from the documentation for more reference:

Update-Package [-Id] [-IgnoreDependencies] [-ProjectName ] [-Version ] [-Source ] [-Safe] [-IncludePrerelease] [-Reinstall] [-FileConflictAction] [-WhatIf]

http://docs.nuget.org/docs/reference/package-manager-console-powershell-reference

Philip Pittle
  • 11,821
  • 8
  • 59
  • 123