Redigera

Dela via


Install NuGet client tools

Looking to install a package? See Ways to install NuGet packages.

To work with NuGet as a package consumer or creator, you can use command-line interface (CLI) tools and NuGet features in Visual Studio. This article briefly outlines the capabilities of the different tools, how to install them, and their comparative feature availability.

To get started using NuGet to consume packages, see the following articles:

To get started creating NuGet packages, see these articles:

Tool Description Download
dotnet SDK The CLI tool for .NET Core and .NET Standard libraries, and for any SDK-style project such as one that targets the .NET Framework. This CLI tool is included with the .NET Core SDK and provides core NuGet features on all platforms. In Visual Studio 2017 and later, the dotnet CLI is automatically installed with any .NET Core related workloads. .NET Core SDK
nuget.exe The CLI tool for .NET Framework libraries and for any non-SDK-style project such as one that targets .NET Standard libraries. This CLI tool provides all NuGet capabilities on Windows and most features on Mac and Linux when running under Mono. nuget.exe
Visual Studio On Windows, the NuGet Package Manager is included with Visual Studio 2012 and later. Visual Studio provides the Package Manager UI and the Package Manager Console (PowerShell on Windows). You can use these tools to run most NuGet operations. Visual Studio
Visual Studio for Mac On Mac, certain NuGet capabilities are built in directly. Package Manager Console isn't currently available. For other capabilities, use the dotnet SDK or nuget.exe CLI tools. Visual Studio for Mac
Visual Studio Code On Windows, Mac, and Linux, NuGet capabilities are available through marketplace extensions, or use the dotnet SDK or nuget.exe CLI tools. Visual Studio Code

Note

Visual Studio for Mac is scheduled for retirement by August 31, 2024 in accordance with Microsoft's Modern Lifecycle Policy. For more information, see What's happening to Visual Studio for Mac.

The MSBuild CLI also restores and creates packages. MSBuild isn't a general-purpose tool for working with NuGet. This CLI tool is primarily useful on build servers.

Package Manager Console commands work only within Visual Studio on Windows and don't work within other PowerShell environments.

Support policy

The Visual Studio for Windows support policy can be found at Visual Studio Product Lifecycle and Servicing.

The most recent version of NuGet.exe is fully supported and can be relied on for bug fixes, updates, and enhancements. For more information on NuGet.exe's support policy, see the Microsoft Modern Lifecycle Policy.

The .NET SDK support policy can be found at .NET and .NET Core Support Policy.

Patch Releases

Patched versions of NuGet.exe will be released exclusively when critical security fixes are required for a long-term support (LTS) version of Visual Studio or .NET SDK.

All security bugs should be reported to the Microsoft Security Response Center (MSRC) at MSRC's report page. Also, see the security policy in the NuGet.Client repo.

NuGet.exe unlisting

Out-of-support, deprecated, or vulnerable NuGet.exe versions will be removed from tools.json.

Visual Studio

In Visual Studio 2017 and later, the Visual Studio installer includes the NuGet Package Manager with any workload that employs .NET.

You can also install the Package Manager separately or verify your installation. Run the Visual Studio installer and check the option setting under Individual Components > Code tools > NuGet package manager. For more information, see Install and manage packages in Visual Studio by using the NuGet Package Manager.

Note

For earlier versions of Visual Studio, you can download NuGet extensions at https://dist.nuget.org/index.html.

CLI tools

You can use either the dotnet CLI or the nuget.exe CLI to support NuGet features in the Visual Studio IDE. The dotnet CLI is installed with some Visual Studio workloads, such as .NET Core. The nuget.exe CLI must be installed separately as described earlier. For a feature comparison of the tools, see the feature availability section.

  • To target .NET Core or .NET Standard, use the dotnet SDK CLI tool. This CLI is required for the SDK-style project format, which uses the SDK attribute.

  • To target the .NET Framework (non-SDK-style project only), use the nuget.exe CLI tool. If the project is migrated from packages.config to PackageReference, use the dotnet SDK CLI tool instead.

dotnet SDK

The dotnet SDK is the .NET Core 2.0 CLI tool, which works on all platforms (Windows, Mac, and Linux) and provides core NuGet features such as installing, restoring, and publishing packages. The dotnet CLI provides direct integration with .NET Core project files (such as .csproj), which is helpful in most scenarios. This CLI is also built directly for each platform and doesn't require installation of Mono.

Install the dotnet SDK

To learn how to use basic commands with the dotnet SDK CLI tool, see Install and manage NuGet packages with the dotnet CLI.

nuget.exe CLI

The NuGet CLI, nuget.exe, is the command-line utility for Windows that provides all NuGet capabilities. This CLI can also run on Mac OSX and Linux by using Mono with some limitations.

To learn how to use basic commands with the nuget.exe CLI tool, see Manage NuGet packages with the nuget.exe CLI.

Install nuget.exe

Always install the latest version of the tool that supports your configuration.

  • You can download the latest recommended version at https://dist.nuget.org/win-x86-commandline/latest/nuget.exe.
  • If you already have the nuget.exe CLI tool installed, you can update the tool to the latest version with the command nuget update -self.
  • For compatibility with older continuous integration systems, a previous URL, https://nuget.org/nuget.exe currently provides the deprecated version 2.8.6 of the CLI tool.
  1. Visit nuget.org/downloads and download NuGet version 3.3 or later.

    • Version 5.0 and later requires the .NET Framework version 4.7.2 or later.
    • Version 4.1.0 and later is required to publish packages to nuget.org.
    • Version 2.8.6 isn't compatible with Mono.
  2. 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.

  3. To use the CLI tool from anywhere, add the folder location for the nuget.exe file to your PATH environment variable.

Feature availability

The following table compares the available features for the dotnet and nuget.exe CLI tools for supported platforms.

Feature dotnet CLI nuget CLI (Windows) nuget CLI (Mono) Visual Studio (Windows) Visual Studio for Mac
Search packages
Install/uninstall packages ✔ (1)
Update packages
Restore packages ✔ (2)
Manage package feeds (sources)
Manage packages on a feed
Set API keys for feeds
Create packages (3) ✔ (4)
Publish packages
Replicate packages
Manage global-package and cache folders
Manage NuGet configuration

Feature notes

  • (1) Doesn't affect project files. Use the dotnet SDK CLI tool instead.
  • (2) Works only with packages.config file and not with solution (.sln) files.
  • (3) Various advanced package features are available through the CLI only as they aren't represented in the Visual Studio UI tools.
  • (4) Works with .nuspec files but not with project files.

Upcoming features

If you want to preview upcoming NuGet features, install a Visual Studio Preview, which works side-by-side with stable releases of Visual Studio. To report problems or share ideas for previews, open an issue on the NuGet GitHub repository.

Developers working on Windows can also explore the NuGet Package Explorer. This application is an open-source standalone tool that lets you visually explore, create, and edit NuGet packages. It's helpful for many scenarios, such as making experimental changes to a package structure without rebuilding the package.