NuGet CLI reference
The NuGet Command Line Interface (CLI),
nuget.exe, provides the full extent of NuGet functionality to install, create, publish, and manage packages without making any changes to project files.
To use any command, open a command window or bash shell, then run
nuget followed by the command and appropriate options, such as
nuget help pack (to view help on the pack command).
This documentation reflects the latest version of the NuGet CLI. For exact details for any given version that you're using, run
nuget help for the desired command.
- Visit nuget.org/downloads and select NuGet 3.3 or higher (2.8.6 is not compatible with Mono). The latest version is always recommended, and 4.1.0+ is required to publish packages to nuget.org.
- Each download is the
nuget.exefile directly. Instruct your browser to save the file to a folder of your choice. The file is not an installer; you won't see anything if you run it directly from the browser.
- Add the folder where you placed
nuget.exeto your PATH environment variable to use the CLI tool from anywhere.
Behaviors may vary slightly by OS distribution.
Install Mono 4.4.2 or later.
Execute the following command at a shell prompt:
# Download the latest stable `nuget.exe` to `/usr/local/bin` sudo curl -o /usr/local/bin/nuget.exe https://dist.nuget.org/win-x86-commandline/latest/nuget.exe
Create an alias by adding the following script to the appropriate file for your OS (typically
# Create as alias for nuget alias nuget="mono /usr/local/bin/nuget.exe"
Reload the shell. Test the installation by entering
nugetwith no parameters. NuGet CLI help should display.
To make the NuGet CLI available within the Package Manager Console in Visual Studio, see Using the nuget.exe CLI in the console.
See feature availability for exact details.
- All commands are available on Windows.
- All commands work with nuget.exe running on Mono except where indicated for
pushcommands are also available on Mac and Linux through the dotnet CLI.
Commands and applicability
Available commands and applicability to package creation, package consumption, and/or publishing a package to a host:
|Common Commands||Applicable Roles||NuGet Version||Description|
|pack||Creation||2.7+||Creates a NuGet package from a
|push||Publishing||All||Publishes a package to a package source.|
|config||All||All||Gets or sets NuGet configuration values.|
|help or ?||All||All||Displays help information or help for a command.|
|locals||Consumption||3.3+||Lists locations of the global-packages, http-cache, and temp folders and clears the contents of those folders.|
|restore||Consumption||2.7+||Restores all packages referenced by the package management format in use. When running on Mono, restoring packages using the PackageReference format is not supported.|
|setapikey||Publishing, Consumption||All||Saves an API key for a given package source when that package source requires a key for access.|
|Secondary Commands||Applicable Roles||NuGet Version||Description|
|add||Publishing||3.3+||Adds a package to a non-HTTP package source using hierarchical layout. For HTTP sources, use push.|
|delete||Publishing||All||Removes or unlists a package from a package source.|
|init||Creation||3.3+||Adds packages from a folder to a package source using hierarchical layout.|
|install||Consumption||All||Installs a package into the current project but does not modify projects or reference files.|
|list||Consumption, perhaps Publishing||All||Displays packages from a given source.|
|mirror||Publishing||Deprecated in 3.2+||Mirrors a package and its dependencies from a source to a target repository.|
|sources||Consumption, Publishing||All||Manages package sources in configuration files.|
|update||Consumption||All||Updates a project's packages to the latest available versions. Not supported when running on Mono.|
Different commands make use of various Environment variables.
NuGet CLI commands by applicable roles:
Developers concerned only with consuming packages, for example, need only understand that subset of NuGet commands.
Command option names are case-insensitive. Options that are deprecated are not included in this reference, such as
NoPrompt (replaced by
Verbose (replaced by
We'd love to hear your thoughts. Choose the type you'd like to provide:
Our feedback system is built on GitHub Issues. Read more on our blog.