Is there a way to download a previous version of a package with NuGet, not the latest one?
Bring up the Package Manager Console in Visual Studio - it's in Tools / NuGet Package Manager / Package Manager Console. Then run the Install-Package command:
Install-Package Common.Logging -Version 1.2.0
See the command reference for details.
Edit:
In order to list versions of a package you can use the Get-Package command with the remote argument and a filter:
Get-Package -ListAvailable -Filter Common.Logging -AllVersions
By pressing tab after the version option in the Install-Package
command, you get a list of the latest available versions.
Get-Package -ListAvailable
does not list all available versions for me. –
Orlon ListAvailable
argument in the Get-Package
command has been deprecated. You should use Find-Package <id> -AllVersions
instead –
Sterne Browse to its page in the package index, eg. http://www.nuget.org/packages/Newtonsoft.Json/4.0.5
Then follow the install instructions given:
Install-Package Newtonsoft.Json -Version 4.0.5
Alternatively to download the .nupkg
file, follow the 'Download' link eg. https://www.nuget.org/api/v2/package/Newtonsoft.Json/4.0.5
Obsolete: install my Chrome extension Nutake which inserts a download link.
Another option is to change the version number in the packages.config
file. This will cause NuGet to download the dlls for that version the next time you build.
packages.config
, 3. manage the NuGet packages on the solution, 3a. add the package to another project, removing it from the original project, and confirm this, 3b. reverse 3a and confirm. Step 3a will add the correct assembly reference to another project and remove it from the original. Step 3b will add the correct assembly reference to the original project. –
Shericesheridan In NuGet 3.0 the Get-Package
command is deprecated and replaced with Find-Package
command.
Find-Package Common.Logging -AllVersions
See the NuGet command reference docs for details.
This is the message shown if you try to use Get-Package in Visual Studio 2015.
This Command/Parameter combination has been deprecated and will be removed
in the next release. Please consider using the new command that replaces it:
'Find-Package [-Id] -AllVersions'
Or as @Yishai said, you can use the version number dropdown in the NuGet screen in Visual Studio.
As the original question does not state which NuGet frontend should be used, I would like to mention that NuGet 3.5 adds support for updating to a specific version via the command line client (which works for downgrades, too):
NuGet.exe update Common.Logging -Version 1.2.0
I landed on this page but my requirement is different, I wanted to download old version of .nupkg file instead of downloading from VS2019 - to get old version of .nupkg
- Go to nuget.org
- Search package ex: Newton Json
- Click on result package name
- Click on Versions tab and download the version you want
By using the Nuget Package Manager UI as mentioned above it helps to uninstall the nuget package first. I always have problems when going back on a nuget package version if I don't uninstall first. Some references are not cleaned properly. So I suggest the following workflow when installing an old nuget package through the Nuget Package Manager:
- Selected your nuget server / source
- Find and select the nuget package your want to install an older version
- Uninstall current version
- Click on the install drop-down > Select older version > Click Install
Good Luck :)
© 2022 - 2024 — McMap. All rights reserved.