Visual Studio Enterprise 2019 16.9.3 (latest) Unity 2020.3.1f1. I've only installed the 'Game development with Unity' workload in the Visual Studio Installer. I've also set Visual Studio as the external script editor in Unity and i can successfully run the unity project from vs. The NuGet Team does not provide support for this client. Please contact its maintainers for support. #r 'nuget: Microsoft.VisualStudio.Shell.15.0, 17.0.0-preview-1-31216-036'.
-->The NuGet Package Manager Console lets you use NuGet PowerShell commands to find, install, uninstall, and update NuGet packages. Using the console is necessary in cases where the Package Manager UI does not provide a way to perform an operation. To use nuget.exe
CLI commands in the console, see Using the nuget.exe CLI in the console.
The console is built into Visual Studio on Windows. It is not included with Visual Studio for Mac or Visual Studio Code.
Important
The commands listed here are specific to the Package Manager Console in Visual Studio, and differ from the Package Management module commands that are available in a general PowerShell environment. Specifically, each environment has commands that are not available in the other, and commands with the same name may also differ in their specific arguments. When using the Package Management Console in Visual Studio, the commands and arguments documented in this present topic apply.
Find and install a package
For example, finding and installing a package is done with three easy steps:
Open the project/solution in Visual Studio, and open the console using the Tools > NuGet Package Manager > Package Manager Console command.
Find the package you want to install. If you already know this, skip to step 3.
Run the install command:
Important
All operations that are available in the console can also be done with the NuGet CLI. However, console commands operate within the context of Visual Studio and a saved project/solution and often accomplish more than their equivalent CLI commands. For example, installing a package through the console adds a reference to the project whereas the CLI command does not. For this reason, developers working in Visual Studio typically prefer using the console to the CLI.
Tip
Many console operations depend on having a solution opened in Visual Studio with a known path name. If you have an unsaved solution, or no solution, you can see the error, 'Solution is not opened or not saved. Please ensure you have an open and saved solution.' This indicates that the console cannot determine the solution folder. Saving an unsaved solution, or creating and saving a solution if you don't have one open, should correct the error.
Opening the console and console controls
Open the console in Visual Studio using the Tools > NuGet Package Manager > Package Manager Console command. The console is a Visual Studio window that can be arranged and positioned however you like (see Customize window layouts in Visual Studio).
By default, console commands operate against a specific package source and project as set in the control at the top of the window:
Selecting a different package source and/or project changes those defaults for subsequent commands. To overrride these settings without changing the defaults, most commands support
-Source
and-ProjectName
options.To manage package sources, select the gear icon. This is a shortcut to the Tools > Options > NuGet Package Manager > Package Sources dialog box as described on the Package Manager UI page. Also, the control to the right of the project selector clears the console's contents:
The rightmost button interrupts a long-running command. For example, running
Get-Package -ListAvailable -PageSize 500
lists the top 500 packages on the default source (such as nuget.org), which could take several minutes to run.
Install a package
See Install-Package.
Installing a package in the console performs the same steps as described on What happens when a package is installed, with the following additions:
- The Console displays applicable license terms in its window with implied agreement. If you do not agree to the terms, you should uninstall the package immediately.
- Also a reference to the package is added to the project file and appears in Solution Explorer under the References node, you need to save the project to see the changes in the project file directly.
Uninstall a package
See Uninstall-Package. Use Get-Package to see all packages currently installed in the default project if you need to find an identifier.
Uninstalling a package performs the following actions:
- Removes references to the package from the project (and whatever management format is in use). References no longer appear in Solution Explorer. (You might need to rebuild the project to see it removed from the Bin folder.)
- Reverses any changes made to
app.config
orweb.config
when the package was installed. - Removes previously-installed dependencies if no remaining packages use those dependencies.
Update a package
See Get-Package and Update-Package
Find a package
See Find-Package. In Visual Studio 2013 and earlier, use Get-Package instead.
Availability of the console
Starting in Visual Studio 2017, NuGet and the NuGet Package Manager are automatically installed when you select any .NET-related workloads; you can also install it individually by checking the Individual components > Code tools > NuGet package manager option in the Visual Studio installer.
Also, if you're missing the NuGet Package Manager in Visual Studio 2015 and earlier, check Tools > Extensions and Updates... and search for the NuGet Package Manager extension. If you're unable to use the extensions installer in Visual Studio, you can download the extension directly from https://dist.nuget.org/index.html.
Nuget Visual Studio Code
The Package Manager Console is not presently available with Visual Studio for Mac. The equivalent commands, however, are available through the NuGet CLI. Visual Studio for Mac does have a UI for managing NuGet packages. See Including a NuGet package in your project.
The Package Manager Console is not included with Visual Studio Code.
Extend the Package Manager Console
Some packages install new commands for the console. For example, MvcScaffolding
creates commands like Scaffold
shown below, which generates ASP.NET MVC controllers and views:
Set up a NuGet PowerShell profile
Visual Studio Code Nuget Cli
A PowerShell profile lets you make commonly-used commands available wherever you use PowerShell. NuGet supports a NuGet-specific profile typically found at the following location:
%UserProfile%DocumentsWindowsPowerShellNuGet_profile.ps1
To find the profile, type $profile
in the console:
For more details, refer to Windows PowerShell Profiles.
Use the nuget.exe CLI in the console
To make the nuget.exe
CLI available in the Package Manager Console, install the NuGet.CommandLine package from the console:
Base classes, objects and extension methods for developing Visual Studio extensions
Requires NuGet 2.8 or higher.
Dependencies
- Luminous.Code.Core(>= 1.4.2)
Used By
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
Visual Studio Code Nuget Install
Version History
Version | Downloads | Last updated |
---|---|---|
1.4.2 | 293 | 7/20/2019 |
1.4.0 | 327 | 4/27/2019 |
1.3.0 | 290 | 4/8/2019 |
1.2.1 | 328 | 4/4/2019 |
1.2.0 | 304 | 3/18/2019 |
1.1.0 | 593 | 1/26/2018 |
1.0.3 | 485 | 11/25/2017 |
1.0.2.7 | 461 | 11/24/2017 |
1.0.2 | 602 | 4/9/2017 |
1.0.1 | 534 | 4/9/2017 |
1.0.0 | 573 | 4/9/2017 |