There are two primary tools available to help you build, publish and consume NuGet packages:
- The NuGet CLI is the command-line utility for Windows that provides all NuGet capabilities; it can also be run on Mac OSX and Linux using Mono, or through the .NET Core CLI (
- The NuGet Package Manager in Visual Studio (Windows only) is a GUI tool for managing packages and includes a PowerShell console through which you can use certain NuGet commands directly within Visual Studio. The Package Manager UI and Console are both included with Visual Studio (on Windows) 2012 and later and can be installed manually for earlier versions.
The NuGet CLI and Package Manager both support the following operations:
- Search packages
- Install packages
- Update packages
- Uninstall packages
- Restore packages (UI only in the Package Manager)
- Manage NuGet sources
The following capabilities are supported only in the NuGet CLI:
- Manage packages (nuget.org or private feed)
- Create packages
- Publish packages
- Manage Nuget.Config
- Manage the NuGet cache
- Replication a package
Another good tool is the NuGet Package Explorer, an open-source, stand-alone tool to visually explore, create, and edit NuGet packages. It's very helpful, for example, to make experimental changes to a package structure without having to rebuild the package each time. The cross-platform .NET Core CLI toolchain, used for developing .NET Core applications, supports several NuGet commands, such as delete, locals, push, pack, and restore.
The NuGet command-line interface provides access to all NuGet capabilities, and can be run on Windows, Mac OSX, and Linux as described in the following sections.
On Windows, install the NuGet CLI using any of the following methods:
- nuget.org: Various versions of
nuget.exeare available on nuget.org/downloads. Each download link points directly to an
.exefile, so be sure to right-click and save the file to your computer rather than running it from the browser. If desired, add the save location to your PATH environment variable so you can NuGet from anywhere.
With NuGet 1.4+, you can use
nuget update -self to update your existing nuget.exe to the latest version.
choco install nuget.commandline
Visual Studio: Install the NuGet.CommandLine package from the Package Manager Console in Visual Studio.
NuGet 2.x users
Because of breaking changes introduced in NuGet 3.2, https://nuget.org/nuget.exe points to the latest stable NuGet 2.x release to prevent CI systems from potentially breaking.
Mac OSX and Linux
On Mac OSX and Linux, there are two ways to run the NuGet CLI:
Install the .NET Core SDK, which includes the core NuGet capabilities. Downloads are also listed on github.com/dotnet/cli. If you need fuller capabilities, then use the second option below to use
Commands tested to work:
- pack: works with
.nuspecfiles but not with project files.
- restore: works with
project.jsonfiles but not with solution (
- pack: works with
Commands that do not work:
NuGet Package Manager in Visual Studio
The NuGet Package Manager is included in every edition of Visual Studio on Windows, 2012 and later. It includes the Package Manager UI (reference), and the Package Manager Console through which you can access tools that come with certain packages (reference).
The console requires PowerShell 2.0, which will already be installed on Windows 7 or higher and Windows Server 2008 R2 or higher.
Package Manager Console commands also work only within Visual Studio on Windows. Use the NuGet CLI outside of that environment, including with Visual Studio for Mac.
Package Manager installation for Visual Studio 2010 and earlier
These steps are not necessary for Visual Studio 2012 and later, which already include the Package Manager.
- In Visual Studio, click Tools > Extension and Updates.
- Navigate to Online, search for "NuGet Package Manager for Visual Studio," and click Download.
- In the Installer dialog box, click Install.
- When installation is complete, restart Visual Studio.
If you're unable to use the Extensions and Updates dialog in Visual Studio (for example, its blocked by a proxy), you can download extensions for Visual Studio 2013 and 2015 directly at https://dist.nuget.org/index.html.
Updating the Package Manager
For Visual Studio 2015 Update 2 and later, the Package Manager is automatically updated to the latest stable release.
For earlier versions of Visual Studio, select the Tools > Extensions and Updates command and click on the Updates tab to see if a new version of the Package Manager is available.
If you'd like to preview upcoming NuGet features, install the Visual Studio 2017 Preview, which works side-by-side with stable releases of Visual Studio.
Note that the previous NuGet Beta Channel (
https://dotnet.myget.org/F/nuget-beta/vsix/) for Visual Studio 2015 is no longer used.
To report problems with any release of NuGet or to share ideas, open an issue on the NuGet GitHub repository.