[install|get]-package vs. list-packages

Feb 21, 2011 at 2:54 PM
Edited Feb 21, 2011 at 2:55 PM

It seems that the NuGet team aren't yet settled with the syntax of the list and install operations since NuGet 1.1 has again changed the syntax for installing a package from install-package to get-package.

It feels unnatural that "get-package" (singular) lists the currently installed packages (plural) but when called with a package name, a single package is installed. And "get-package -ListAvailable" is ... well ... just plain ugly!

May I suggest that [get|install]-package should get/install the named package from the available source feeds wheras "list-packages -[local|remote|updated] should allow the user to browse, list and explore the local/remote catalog in a non-intrusive manner?


Feb 21, 2011 at 4:23 PM
Edited Feb 21, 2011 at 4:29 PM

Hi BitCrazed,

If you are new to PowerShell, then the naming will seem a little strange [at first.] However, the naming is consistent with the Microsoft rules and guidlines for Cmdlets. It's unfortunate that things have changed but for the 1.0 release, the NuGet team was not fully aware of these guidelines and why they are important. Nouns are always singular: try opening a PowerShell prompt yourself to see:

ps> get-command | select -unique noun | sort noun 

Also, the verb list (the portion of the cmdlet precending the hyphen) is a fixed list. "List" is not an approved verb in PowerShell. You can read about the guidelines here:


When we choose parameter names (like ListAvailable) we try to use parameters that already exist in PowerShell to perform a similar function. In this case, the built-in command "Get-Module" reflects the behaviour of our Get-Package cmdlet quite closely:

# return currently LOADED modules
ps> Get-Module

# return modules AVAILABLE to load
ps> Get-Module -ListAvailable

Hopefully this makes the reasoning a little clearer. This is for your own good ;-)


p.s. If you really can't live with this, you are free to create your own aliases or functions that wrap the official ones for your own use.

Feb 21, 2011 at 5:59 PM
NuGet 1.1 didn't change the syntax for installing a package. It changed the syntax for listing packages.
Feb 21, 2011 at 6:26 PM

Even the syntax for listing packages didn't change much from 1.0 to 1.1. It just changed from 'get-package -remote' to 'get-package -ListAvailable', and in fact -remote is still supported in 1.1 as an alias. Note that you can shorten it to just 'get-package -l'.

As for list-package, it was supported by deprecated in 1.0, and we removed it in 1.1.