dotnet CLI commands
The dotnet
command-line interface (CLI), which runs on Windows, Mac OS X, and Linux, provides a number of essential commands such as installing, restoring, and publishing packages. If dotnet satisfies your needs, it's not necessary to use nuget.exe
.
For examples of using these commands to consume packages, see Install and manage packages using the dotnet CLI. For examples of using these commands to create packages, see Create and publish a package using the dotnet CLI.
For the complete command reference on dotnet
CLI, see .NET Core command-line interface (CLI) tools.
Package consumption
- dotnet add package: Adds a package reference to the project file, then runs
dotnet restore
to install the package. - dotnet remove package: Removes a package reference from the project file.
- dotnet restore: Restores the dependencies and tools of a project. As of NuGet 4.0, this runs the same code as
nuget restore
. - dotnet nuget locals: Lists locations of the global-packages, http-cache, and temp folders and clears the contents of those folders.
- dotnet new nugetconfig: Creates a
nuget.config
file to configure NuGet's behavior.
Package creation
- dotnet pack: Packs the code into a NuGet package.
- dotnet nuget push: Publishes a package to a NuGet server. Applicable to nuget.org, Azure Artifacts, and third-party NuGet servers.
- dotnet nuget delete: Deletes or unlists a package from a NuGet server. Applicable to nuget.org, Azure Artifacts, and third-party NuGet servers.
- dotnet nuget verify: Verifies a signed NuGet package.