Get NuGet.exe version from command-line

Command LineVersionNuget

Command Line Problem Overview


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?

Command Line Solutions


Solution 1 - Command Line

Typing nuget help from the command line will in addition to the expected help information also list the current NuGet.exe version.

Solution 2 - Command Line

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 - Command Line

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.

Solution 4 - Command Line

I had his very question, in my Centos7 Docker container.

This is how I solved it:

yum info nuget

yum info nuget returns a great deal! Just wanting the numbers, I added a grep and a sed to clean things up.

yum info nuget | grep Version | sed 's/^.*: //'

To put in in a variable in your bash script:

nuget_version=$(yum info nuget | grep Version | sed 's/^.*: //')

Solution 5 - Command Line

On Windows 10 CMD console, try this:

C:>nuget help |findstr "NuGet Version"

On Windows 10 PowerShell console, try this:

PS C:> nuget help | select -First 1

Both of them will return something like:

NuGet Version: 5.8.1.7021

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionPer SamuelssonView Question on Stackoverflow
Solution 1 - Command LineJulianView Answer on Stackoverflow
Solution 2 - Command LineNiraj TrivediView Answer on Stackoverflow
Solution 3 - Command LineLegendsView Answer on Stackoverflow
Solution 4 - Command LineJesse ChisholmView Answer on Stackoverflow
Solution 5 - Command LineTianCaiBenBenView Answer on Stackoverflow