Monday, October 24, 2011

Downloading an old version of a NuGet package

By default NuGet will always download the latest version of a package. But what if you don’t want the most reason version? Luckily there is a way to specify the package version by using the Package Manager Console in Visual Studio.
First bring up the Package Manager Console in Visual Studio. Go to Tools|Library Package Manager|Package Manager Console.
You can install a package by using the ‘Install-Package’ powershell command. This command has a Version argument that can be used to specify a specific version.
Install-Package PackageName -Version 1.3.1
See the command reference for details. If you use the Intellisense feature inside the Package Manager Console(by using the TAB key), you even get the list of available versions.

The same thing works if you want to update an existing package, this time by using the ‘Update-Package’ powershell command.

Update-Package PackageName -Version 1.3.2

No comments: