Get NuGet.exe version from command-line

72,930

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

enter image description here


Cmd.exe
nuget ?

enter image description here


Not working anymore

Command line (cmd.exe) | Package Manager Console in Visual Studio

1.) nuget ? v
2.) nuget help v

enter image description here

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.

Share:
72,930
Per Samuelsson
Author by

Per Samuelsson

Updated on July 23, 2022

Comments

  • Per Samuelsson
    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
    tkerwood almost 7 years
    try nuget help | head -1 for a single line result.
  • Julian
    Julian almost 7 years
    Or nuget help | select -First 1 if you're on Windows (PowerShell).
  • ThetaSinner
    ThetaSinner over 5 years
    Any idea why that powershell command gives an exit code of 1?
  • volody
    volody over 5 years
    displaying different versions in About: NuGet Package Manager 4.6.0 and Console: Package Manager Host 4.7.0.5212
  • Julian
    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
    Anthony Walsh over 5 years
    The 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
    Jonathan Niu about 5 years
    interestingly enough, v actually triggers nuget verify now in newer versions, (tested with 4.9.3.5777) and is no longer an unknown command
  • Julian
    Julian almost 5 years
    A comment accompanying the down-vote would be highly appreciated, perhaps event with an edit suggestion to improve the answer...