Common NuGet Package Manager Console Commands You Should Know

Within Visual Studio there is a console window that many know little about. I myself have finally started researching ways to improve my productivity via this console window, the Package Manager Console. In doing my research and using some of these commands on a daily or weekly basis, I figured I’d jot these down for my own notes, and anybody that uses NuGet.

Update Package

The update package without a project name will iteratively progress through your solution, find the package by the specified name, then re-install that package of the same version. This is my favorite command to run when pulling up a project from a freshly created branch.

Update-Package –reinstall [PackageName]

When you include a project name, the console will install the packages just within that project. Useful when you have one project causing an issue and you don’t want to run the reinstall command of the entire solution.

Update-Package –reinstall -project [ProjectName]

Install Package

If you know the package name already you want to include in your project, the following command will be a quick alternative to the GUI of the NuGet Package Manager.

Install-Package [PackageName] [ProjectName]

Get Package

If you want to view the available packages via a supplied filter (There are thousands of packages), the following command will do just that!

Get-Package -ListAvailable -Filter [PackageName]

 

Additional Reference:

Want to learn some more Powershell / NuGet commands to speed up the NuGet experience? Take a look at the documentation on NuGet’s site.

 

Jacob Saylor

Software developer in Kentucky

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: