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.
To learn how to use basic commands with the nuget.exe
CLI, see Install and use packages using the nuget.exe CLI.
Always install the latest version of the tool that supports your configuration.
https://dist.nuget.org/win-x86-commandline/latest/nuget.exe
.nuget.exe
CLI tool installed, you can update the tool to the latest version with the command nuget update -self
.https://nuget.org/nuget.exe
currently provides the deprecated version 2.8.6 of the CLI tool.Visit nuget.org/downloads and download NuGet version 3.3 or later.
nuget.org
.Each download is the nuget.exe
file directly. Instruct your browser to save the file to a folder of your choice. The download file isn't an installer, so you don't see anything if you run the file directly from the browser.
To use the CLI tool from anywhere, add the folder location for the nuget.exe
file to your PATH environment variable.
Behaviors can vary slightly based on your operating system distribution.
Install Mono version 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 operating system (typically ~/.bash_aliases
or ~/.bash_profile
):
# Create as alias for nuget
alias nuget="mono /usr/local/bin/nuget.exe"
Reload the shell. Test the installation by entering the command nuget
with no parameters. NuGet CLI help should display.
See feature availability for exact details.
pack
, restore
, and update
.pack
, restore
, delete
, locals
, and push
commands are also available on Mac and Linux through the dotnet CLI.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.nuspec
or project file. When running on Mono, creating a package from a project file is not supported. 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. spec Creation All Generates a .nuspec
file, using tokens if generating the file from a Visual Studio project. 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. search Consumption 5.8+ Searches a given source using the query string provided. 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:
Role Commands Consumptionconfig
, help
, install
, list
, locals
, restore
, search
, setapikey
, sources
, update
Creation config
, help
, init
, pack
, spec
Publishing add
, config
, delete
, help
, list
, push
, setapikey
, sources
Developers concerned only with consuming packages, for example, need only understand that subset of NuGet commands.
Note
Command option names are case-insensitive. Options that are deprecated are not included in this reference, such as NoPrompt
(replaced by NonInteractive
) and Verbose
(replaced by Verbosity
).
NuGet.exe's progress, warning and error messages are translated into the same locales as Visual Studio. NuGet.exe ships as a single exe, and due to size considerations, only the most commonly surfaced messages are translated in all languages.
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4