Welcome Login

Nuget package manager (and package manager console)

Nuget is a free and open source package manager for the .net framework.

Nuget visual studio extension makes it easy to add, remove, and update libraries and tools in visual studio projects that use the .net Framework.

Nuget is distributed as a visual studio extension, and included in the popular c# code snippet tool linqpad.



Nuget package manager:

To install a package using nuget package manager ui:


1. Open nuget package manager:

Method 1:

Tools > Nuget Package Manager > Manage NuGet Packages for Solution ...


Method 2:

Right-click on the References folder of your project > select 'Manage NuGet Packages...'



2. In Manage NuGet Packages, enter required package in Search Online, select package and click 'Install':




To uninstall a package using nuget package manager ui:


1. Tools > Nuget Package Manager > Manage Nuget Packages for Solution.

2. Goto 'Installed packages' (left column) > select 'All'.

3. Select package from list of installed packages, and click Manage button.

4. Uncheck package and click OK.





Package manager console:

Alternatively, you can use the 'Package Manager Console' to install package:


1. Goto: Tools > Library Package Manager > Package Manager Console:



2. To install a package, enter package manager console command: 'install-package':

Eg: installing package: entityframework

PM > install-package entityframework


Eg2: installing a package

PM > install-package mvcscaffolding


Eg3: uninstalling a package and installing a package:



Note: Package Manager Console requires: PowerShell 2.0.


Note2: packages manager console is used in mvc migrations.


Note3: To fix broken package reference, try using following command:

update-package Owin -reinstall

-Reinstall flag: will cause nuget to re-apply the same version of the package that you already have installed. 
                 It's like a Repair operation. Generally, it will already be in the packages folder and hence won't need to download. 
                 Without this flag, the operation will update the package to the latest version, 
                 but only if there is a newer version, which may impact other packages that depend on it.





To update nuget package manager (vs2013):

Tools > Extensions and Updates... > Select Updates > Visual Studio Gallery > select 'Nuget Package Manager' and update.






For more information on update nuget, see here.

And here.



Nuget version:

To find nuget version:

VS > Help menu item > About Microsoft Visual Studio > look at the version displayed next to NuGet Package Manager.




Alternatively, launch the Package Manager Console and enter $host:






For nuget example to install entity framework, see here.

Created on: Monday, March 11, 2013 by Andrew Sin