The Package Manager Console is a PowerShell console within Visual Studio used to interact with NuGet and
automate Visual Studio. Note that for more detailed help, you can run the Get-Help CommandName
from within the NuGet Package Manager Console in Visual Studio.
Adds binding redirects to the config file.
Add-BindingRedirect [-ProjectName] <string>
Examines all assemblies within the output path for a project and adds binding redirects to the application (or web) configuration file where necessary. NOTE: As of NuGet 1.2, NuGet automatically runs this command when installing a package.
PARAMETERS -ProjectNameSpecifies the project to analyze and add binding redirects to. Required: true
PM> Add-BindingRedirect MyProjectName
Adds binding redirects to the specified project, MyProjectName.
Gets the set of packages available from the package source. Use the -ListAvailable flag to list packages available from the package source.
Get-Package -Source <string> [-ListAvailable] [-Updates] [-ProjectName] [-Recent] [-Filter <string>] [-First <int>] [-Skip <int>] [-AllVersions]
Gets the set of packages available from the package source. Defaults to only showing the list of installed packages. Use the -ListAvailable flag to list packages available from the package source.
PARAMETERS -SourceSpecifies the URL or directory path for the package source containing the package to install. If omitted, looks in the currently selected package source to find the corresponding package URL. Required: false -ListAvailable Gets packages available from the online package source. Required: false -Recent Gets the list of recently installed packages. Required: false -Updates Gets packages that have an update available from the package source. Required: false -ProjectName Specifies the project to get installed packages from. If omitted, the command will return installed projects for the entire solution. Required: false -Filter Specifies a filter string used to narrow down the list of packages returned. The filter is searched for in the package Id, the description and tags. Required: false -First Specifies the number of packages to return from the beginning of the list. Required: false -Skip Skips (does not return) the specified number of packages, counting from the beginning of the list. Required: false -AllVersions Displays all available versions of a package. The latest version of each package is listed by default. Required: false -IncludePrerelease Indicates whether to include prerelease packages in the returned results. Required: false
PM> Get-Package
Returns the packages installed in the default project.
PM> Get-Package -ListAvailable
Returns a list of packages available online in the current package source.
PM> Get-Package -ListAvailable -Filter Ninject
Returns a list of packages available online using "Ninject" as a search term.
PS> Get-Package -Updates
Returns a list of packages installed in the default project that have updates available in the current package source.
PM> Get-Package -Recent
Returns a list of recently installed packages.
Gets the specified project. If none is specified, returns the default project.
Get-Project [[-Name] <string>] [-All]
Returns a reference to the DTE (Development Tools Environment) for the specified project. If none is specified, returns the default project selected in the Package Manager Console.
PARAMETERS -NameSpecifies the project to return. If omitted, the default project selected in the Package Manager Console is returned. Required: false -All Returns every project in the solution. Required: false
PM> Get-Project
Returns a reference to the default project.
PM> Get-Project MyProjectName
Returns a reference to the specified project, MyProjectName.
PM> Get-Project -All
Returns a reference to every project in the solution.
Installs a package.
Install-Package [-Id]
Installs a package and its dependencies into the project. Installs the latest version of the Elmah package from the current package source into the default project. PM> Install-Package Glimpse -Version 1.0.0 -Project MvcApplication1 Installs version 1.0.0 of Glimpse into the project named MvcApplication1 PM> Install-Package Ninject.Mvc3 -IgnoreDependencies -Source c:\temp\packages Installs the package, Ninject.Mvc3, but not its dependencies. It looks in the directory,
c:\temp\packages to find the package. Creates a package. Creates a new package when supplied with a Nuspec package specification file. Creates a new package based on the current project using a Nuspec file within the project if only one such file is found. Creates a new package from the specified project, MyProjectName using the specified Nuspec file, MyPackage.nuspec. Open the browser pointing to ProjectUrl, LicenseUrl or ReportAbuseUrl of the specified package. Open the browser pointing to ProjectUrl, LicenseUrl or ReportAbuseUrl of the specified package. Opens a browser to the project URL specified in the Ninject package. Opens a browser to the license URL specified in the Ninject package. Opens a browser to the URL at the current package source used to report abuse for the specified package. Assigns the license URL to the variable, $url, without opening the URL in a browser. Uninstalls a package. Uninstalls a package. If other packages depend on this package, the command will fail unless the –Force option is specified. Uninstalls the Elmah package from the default project. Uninstalls the Elmah package as well as all its dependencies. If any dependency has another package that depends on it,
it is skipped. Uninstalls the Elmah package even if another package depends on it. Updates a package. Updates a package and its dependencies to a newer version. Updates the Elmah package in every project to the latest version. Updates the Elmah package to a specific version in every project. Updates the Elmah package within the MvcApplication1 project. Updates every package in every project. Updates every package in the MvcApplication1 project. Updates Elmah to the highest "safe" version. For example, if Elmah version 1.0.0 of a package
is installed, and versions 1.0.1, 1.0.2, and 1.1 are available in the feed, the
PARAMETERS
-Id
Examples
PM> Install-Package Elmah
New-Package
New-Package [[-ProjectName] <string>] [-SpecFileName] <string> [-TargetFile] <string> [-NoClobber]
PARAMETERS
-ProjectName
Examples
PM> New-Package
PM> New-Package -Project MyProjectName -SpecFileName MyPackage.nuspec
Open-PackagePage
Open-PackagePage -Id <string> [-Version] [-Source] [-License] [-ReportAbuse] [-PassThru]
PARAMETERS
-Id
Examples
PM> Open-PackagePage Ninject
PM> Open-PackagePage Ninject -License
PM> Open-PackagePage Ninject -ReportAbuse
PM> $url = Open-PackagePage Ninject -License -WhatIf -PassThru
Uninstall-Package
Uninstall-Package [-Id] <string> [-RemoveDependencies] [-Force] [-Version <string>]
PARAMETERS
-Id
Examples
PM> Uninstall-Package Elmah
PM> Uninstall-Package Elmah -RemoveDependencies
PM> Uninstall-Package Elmah -Force
Update-Package
Update-Package [-Id] <string> [-IgnoreDependencies] [-ProjectName <string>] [-Version <string>] [-Source <string>] [-Safe]
PARAMETERS
-Id
Examples
PM> Update-Package Elmah
PM> Update-Package Elmah -Version 1.1.0
PM> Update-Package Elmah -Project MvcApplication1
PM> Update-Package
PM> Update-Package -Project MvcApplication1
PM> Update-Package Elmah -Safe
-Safe
flag updates the package to 1.0.2 instead of 1.1 as it would without the flag.