The NuGet Package Manager Console is built into Visual Studio on Windows version 2012 and later. It is not included with Visual Studio for Mac or Visual Studio Code.
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 2017 installer.
By default, console commands operate against a specific package source and project as set in the control at the top of the window.
To install a package, use Install-Package
command.
The following command adds the Z.EntityFramework.Classic
package to the default project as specified in the console's project selector.
PM> Install-Package Z.EntityFramework.Classic
The following command adds the Z.EntityFramework.Classic package to a project named EFDemo that is not the default
PM> Install-Package Z.EntityFramework.Classic -ProjectName EFDemo
When you install a package, it performs the following actions.
To uninstall a package, use Uninstall-Package
command.
The following command uninstalls the Elmah package from the default project.
Uninstall-Package Elmah
The following command uninstalls the Elmah package and all its unused dependencies.
Uninstall-Package Elmah -RemoveDependencies
The following command uninstalls the Elmah package even if another package depends on it.
Uninstall-Package Elmah -Force
When you uninstall a package, it performs the following actions.