Get NuGet.exe version from command-line
Solution 1
Typing nuget help
from the command line will in addition to the expected help information also list the current NuGet.exe version.
Solution 2
To know which version of NuGet is installed use follow steps
In Visual Studio, use the Help > About Microsoft Visual Studio command and look at the version displayed next to NuGet Package Manager.
Alternatively, launch the Package Manager Console (Tools > NuGet Package Manager > Package Manager Console) and enter
$host
to see information about NuGet including the version.
Solution 3
Windows Powershell:
nuget help | select -First 1
Cmd.exe
nuget ?
Not working anymore
Command line (cmd.exe) | Package Manager Console in Visual Studio
1.) nuget ? v 2.) nuget help v
The "v" command is actually not valid, but with this approach you only get the nuget version number and below the information that "v" is an unknow command.
Per Samuelsson
Updated on July 23, 2022Comments
-
Per Samuelsson almost 2 years
I'd like to get the
NuGet.exe
version using the command-line.I know I can get the version of NuGet running as part of Visual Studio, as per the instructions here, but what I'm after is something similar from the command-line, i.e like:
nuget --version
Any ideas?
-
tkerwood almost 7 yearstry
nuget help | head -1
for a single line result. -
Julian almost 7 yearsOr
nuget help | select -First 1
if you're on Windows (PowerShell). -
ThetaSinner over 5 yearsAny idea why that powershell command gives an exit code of 1?
-
volody over 5 yearsdisplaying different versions in About: NuGet Package Manager 4.6.0 and Console: Package Manager Host 4.7.0.5212
-
Julian over 5 years@ThetaSinner: The PowerShell command
nuget help | select -First 1
works just fine and returns the current NuGet version. If you're having problems a bit more context is needed to help you (and it probably belongs in a separate question as well). -
Anthony Walsh over 5 yearsThe same with me @volody, the first option in my case gives "4.6.0" also, and the second option "4.9.2.5706". It would seem that the version details are not in sync? This page from Microsoft also suggests the same as this answer.
-
Jonathan Niu about 5 yearsinterestingly enough, v actually triggers nuget verify now in newer versions, (tested with 4.9.3.5777) and is no longer an unknown command
-
Julian almost 5 yearsA comment accompanying the down-vote would be highly appreciated, perhaps event with an edit suggestion to improve the answer...