dotnet commands

The dotnet command-line interface, which runs on Windows, Mac OS X, and Linux, provides a number of essential nuget.exe commands as listed below. If dotnet satisfies your needs, it's not necessary to use nuget.exe.

For complete information on dotnet, 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.

Package creation

  • dotnet pack: Packs the code into a NuGet package. As of NuGet 4.0, this runs the same code as nuget pack.
  • dotnet nuget push: Pushes a package to a server and publishes it, applicable to nuget.org, Visual Studio Team Services, and third-party NuGet servers.
  • dotnet nuget delete: Deletes or unlists a package from a host, applicable to nuget.org, Visual Studio Team Services, and third-party NuGet servers.