How can I install an older version of a package via NuGet?

Nebide Yildiz picture Nebide Yildiz · Apr 18, 2012 · Viewed 217.3k times · Source

I want to install an older version of a package (Newtonsoft.Json). But NuGet rolls back:

PM> Install-Package Newtonsoft.Json -Version 4.0.5
Successfully installed 'Newtonsoft.Json 4.0.5'.
Install failed. Rolling back...
Install-Package : Already referencing a newer version of 'Newtonsoft.Json'.

How can I do it?

Answer

Xavier Decoster picture Xavier Decoster · Apr 18, 2012

Try the following:

Uninstall-Package Newtonsoft.Json -Force

Followed by:

Install-Package Newtonsoft.Json -Version <press tab key for autocomplete>