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.
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.
In NuGet 3.x (Visual Studio 2015) you can just select the version from the UI
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 :)
Related
Is there a way to get NuGet to update versions in package.config to the latest available?
i.e. is there an equivalent command in NuGet for npm's npm update --save/--save-dev?
Is there a NuGet command to update package.config versions?
You can use Update-Package on Package Manager Console window to update all packages to the latest version.
Alternatively, you can also use command with nuget.exe cli:
nuget update <configPath> [options]
where identifies either a packages.config or solution file that lists the project's dependencies.
Just installed VS2017 Community edition -- I read some doc saying that NuGet is included -- but I don't see it and don't see how to add it. Should it appear basically as it did in VS2015?
You have to find it in the installer, second tab - "Packages", under the subheading "Code Tools"
You can launch the installer from the Tools menu in VS, it should be the first option.
I had the same issue. When I installed VS 2017, I only had Microsoft Visual Studio Offline Package. I can't remember how I figured it out, but I did. What you have to do is:
Open VS 2017.
Select Tools > NuGet Package Manager > Package Manager Settings.
In Options, select NuGet Package Manager > Package Sources.
Select + next to Available package sources.
Enter these values:
Name: nuget.org
Source: https://api.nuget.org/v3/index.json
Select OK.
Now, when you run Install Package commands, you'll get what you need.
NOTE: In the Package Manager Console, as your Package source, make sure you select All or nuget.org.
It was included as an option, NOT installed by default.
To install NuGet:
1. Tools > Get Tools and Features...
2. Single Component > Code Tools
3. √ NuGet package manager
4. update.
To find NuGet:
- Project > Manage NuGet packages...
- Tools > NuGet Package Manager
Project or Tools
In Visual Studio 2017,
Click on Tools -> Nuget Package Manager -> Package Manager Console :)
For anyone who stumbled across this question while trying to find out where nuget was installed to use it as a CLI, if you didn't install it individually you need to use it through MsBuild.exe's use of /t:restore to for example restore nuget packages. You'll have to install the individual component if you want the full tool and not just calls to a DLL via MSBuild.
How can I install nuget packages for my PowerShell Projects in Visual Studio 2015? I have tried to do it with both the PowerShell Module Project and PowerShell Script Project. I have installed PowerShell Tools for Visual Studio 2015.
When I open these projects, the Default project in the Package Manager Console is empty. Here is a screenshot of what I mean.
When I try to install a nuget package, e.g. Pester, I get the following error.
I know this thread might be outdated and is rather old but my older article with some possible solutions might help here. I tested current state and still, no support inside VS 2015 for PowerShell project and NuGet packages together.
the current state is :
go with https://chocolatey.org/ and install it on your dev box (and CI) => you install pester globally with : choco install pester and update it if needed.
use old packages.config and update by hand version number and run nuget restore (nuget update will no longer work for this type of solution).
version whole pester into repo and call it directly. you can use nuget install pester for this (if you have nuget in path somewhere)
The link : http://rostacik.net/2015/12/16/how-to-use-nuget-packages-even-with-powershell-projects-with-visual-studio-2015/
Using team city as our CI and I've started getting this error message. We've obviously updated System.Net.Http recently which now needs a new version of NuGet. How do I get team city to find the new NuGet version. I've tried installing VS2015 and updating NuGet package manager through there. I've tried pointing directly to the command line nuget.exe (Don't know if that's been updated to v3?)
[restore] The 'System.Net.Http 4.0.0' package requires NuGet client version '3.0' or above, but the current NuGet version is '2.8.60717.93'.
[restore] Process exited with code 1
Do I just have to just wait till MS pushing the new nuget package to nuget?
Thanks
On your teamcity client you can configure the nuget versions available to your build agents.
Go to Administration -> Integrations -> NuGet
From this screen you can click Fetch NuGet and retrieve the latest version. Then you should be able to specify that version on your build step.
Download NuGet 3.1 from this url:
http://dist.nuget.org/win-x86-commandline/v3.1.0-beta/nuget.exe
Then put that on your build server, put the directory in your path, and run your NuGet build steps as "Command Line" commands in TeamCity, using NuGet.exe.
I think you need TeamCity 9.1, as that version contains the VS2015 build tools: https://confluence.jetbrains.com/display/TCD9/What%27s+New+in+TeamCity+9.1
NuGet 3.0 was released with VS2015: http://docs.nuget.org/release-notes/nuget-3.0.0
In earlier versions of Visual Studio you could add a System reference to System.Net.Http, but Microsoft has now moved that into a NuGet package.
I recently installed Visual Studio on a new computer and as a result I now have Nuget 1.5.2. This version doesn't seem to work with my old solution. When I add a new project and try adding references via Nuget, it says they are already installed and does nothing, even though that reference doesn't exist in the new project.
Does anyone know why this might be happening or alternatively where I can download the old Nuget (1.4.2)?
Thanks!
The NuGet Command Line is available as a NuGet package.
Just like with any other NuGet package, you can get a specific version by using the -Version switch in the Package Manager Console.
To get v1.4.2 of the NuGet command line tool, you should execute the following PowerShell script from the Package Manager Console:
Install-Package Nuget.CommandLine -Version 1.4.20615.182