Home » Articles


Sponsored links

CodeDigest Navigation

Technology News
No News Feeds available at this time.

Community News
No News Feeds available at this time.
What is NuGet? How to use NuGet?

By Satheesh Babu
Posted On Mar 21, 2011
Article Rating:
Be first to rate
this article.
No of Comments: 1
Category: Visual Studio 2010
Print this article.

What is NuGet? How to use NuGet?

1.      What is NuGet?

2.      Installing NuGet

3.      Adding Libraries Using NuGet GUI

4.      Adding Libraries Using PowerShell Commands


What is NuGet?

Read Learn Nuget Package Manager in 10 Minutes to understand the latest version of Nuget.

According to the NuGet’s official page,

NuGet is a Visual Studio 2010 extension that makes it easy to add, remove, and update libraries and tools in Visual Studio projects that use the .NET Framework.

In detail, Nuget is a free, open-source package management system offered by the Microsoft ASP.Net team to the developer community to ease the process of integrating any 3rd party open source component into our project.

There are large numbers of free, open source re-usable components available around the web which can be re-used in our projects. For example jQuery, log4net, ELMAH, NInject, Structure Map are few to note. If you notice, every time when we want to integrate these components into our project we will spend some considerable amount of time in downloading it, integrating it and configuring it. Since this is a repeatable task with a scope for automating it, Microsoft introduced a new add-on for Visual Studio called NuGet which can find all the available OSS(Open-Source System) components and integrate it in into our project with their dependent components. NuGet also takes care updating the config file if the component requires adding some settings in project config file. It also provides option to update the component and remove the component if required.

Once installed, this add-in gives both GUI based and PowerShell based consoles to find and add components into our project solution. NuGet once loaded will load all the available components (Packages in NuGet terms) from a centralised feed location and will give an option to download and integrate it in our projects. For every component, a package is created and is added with centralised feed system which is then consumed by the NuGet to fetch the available components. With NuGet, you can also create a package of your component and add it to the centralised feed for others to consume thro’ NuGet.


Installing NuGet

You can install the NuGet from the official page at codeplex. The current version is 1.1 as of this writing. Currently, Nuget supports visual studio 2010(also developer edition) in the below platforms.

1.      Windows 7

2.      Windows Vista SP1

3.      Windows Server 2008

4.      Windows Server 2008 R2

5.      Windows Server 2003 SP2

6.      Windows XP SP3

You can install the Nuget through the Extension Manager in Visual Studio 2010. Next section will guide you to do that.


1.      Open Visual Studio 2010.

2.      Go to Tools> Extension Manager.

3.      Extension Manager dialog will load all installed extensions installed in Visual Studio 2010. See the below figure. If the NuGet is already installed, it will be listed here.

Introduction to NuGet in Visual Studio

4.      Click “Online Gallery” tab in the above console. This will load all the available extensions for the visual studio. Once loaded, you can find the “Nuget Package Manager” add-in. Click Download button to download and install. Alternatively, you can type Nuget in the search textbox to load only Nuget from Online Gallery.

How to install NuGet in Visual studio 2010

5.      After downloading, the setup will begin automatically. Refer below. Click Install.

How to install NuGet in Visual studio 2010

6.      Click Close once you get the below screen.

How to install NuGet in Visual studio 2010

In next section, we will see how to use NuGet to find and integrate some 3rd party library using the GUI and PowerShell commands.


Adding Libraries Using NuGet GUI

On successful installation of NuGet, you can see the NuGet option in Tools> Library Package Manager. See the image below.

 How to Add Packages in NuGet

Select “Add Library Package Reference..”. This will bring the NuGet GUI as below. The Installed Packages tab will show if there are any library(or Package) already added through NuGet in your project.


I have installed log4net already in the project; hence you can see it in Installed Packages tab.

How to Add Packages in NuGet

To add a new package, select Online tab. This will load all the available packages in the central feed. You can select a library and click Install to install the package into the project.

How to Add Packages in NuGet

Alternatively, you can search a particular package in search textbox in to right corner. For example, type NHibernate in search textbox and click enter. It will display the package with install option. Refer below,

 How to Add Packages in NuGet

On clicking install, it will install the package like below.

How to Add Packages in NuGet

 Once the selected package is installed, you can see the selected package’s dll into bin(or in References in solution explorer), dependant assemblies if any and configuration settings in config file if any.

Alternatively, you can also use PowerShell commands to find and add assemblies like above. Next section will help you to do the same.


Adding Libraries Using PowerShell Commands

To open the NuGet PowerShell Console, Go to Tools > Library Package Manager > Click “Package Manager Console”.

This will load the PowerShell console where you can use commands to add or remove packages. Type the below command to get all the available commands for NuGet.


get-help NuGet

This will load all the available commands that supports Nuget. See below,



Gets the set of packages available from the package source.



Installs a package and its dependencies into the project.



Uninstalls a package. If other packages depend on this package, the command will fail unless the –Force option is specified.



Updates a package and its dependencies to a newer version.



Creates a new package when supplied with a Nuspec package specification file.



Examines all assemblies within the output path for a project and adds binding redirects to the application (or web) configuration file where necessary.



Returns a reference to the DTE (Development Tools Environment) for the active or specified project.


To Get all the available packages

Get-Package –Remote


To Install a Package

Install-Package packagename


Install-Package NUnit


To Uninstall a package

Uninstall-Package NUnit


Once installed, you will see all the related dll’s and config(if any) in your project solution.





NuGet is a wonderful add-in to the feature rich visual studio that makes the developer life much easier and simpler. It is very obvious that tools like this can increase the developer’s productivity.

Thanks to Microsoft for offering such a wonderful plug-in.


Similar Articles
You can contribute to CodeDiget.Com:
Donate to
Article Feedback
A complete way of explanation
i dont know who wrote this article, but its really clean and clear about what's nuget and how to use it.

Everyone has to read this to know about nuget.

thanks for the good article....