NuGet Overview

NuGet is a Visual Studio extension that makes it easy to add, remove, and update libraries and tools in Visual Studio projects that use the .NET Framework. When you add a library or tool, NuGet copies files to your solution and automatically makes whatever changes are needed in your project, such as adding references and changing your app.config or web.config file. When you remove a library, NuGet removes files and reverses whatever changes it made in your project so that no clutter is left.

NuGet provides a quick and easy way to add features to an existing application while ensuring that those features are integrated into source control. After installing a library, you can commit changes to your source control repository, and then another developer can perform a get operation against the repository in order to start working with the new features.

Everything necessary to install a library or tool is bundled into a package (a .nupkg file). A package includes files to copy to your project and a manifest file that describes the contents of the package and what needs to be done to add or remove the library. Packages are bundled into feeds that Visual Studio accesses in order to present lists of available packages. There is an official feed that is the default source for NuGet, and you can contribute to that feed or create your own feeds.

You work with packages by using a dialog box in Visual Studio or by using PowerShell cmdlets in a dedicated Visual Studio window. Both options are accessible from the Visual Studio main menu; you can also open the dialog box from a Solution Explorer context menu. The PowerShell cmdlets require PowerShell 2.0. Therefore, NuGet requires one of the following operating systems:

  • Windows 7
  • Windows Vista SP1
  • Windows Server 2008
  • Windows Server 2008 R2
  • Windows Server 2003 SP2
  • Windows XP SP3

NuGet runs in Visual Studio 2010 or Visual Web Developer 2010.

Installing NuGet

NuGet can be installed and updated using the Visual Studio Extension Manager. To check if your copy of Visual Studio already has the NuGet extension, look for Library Package Manager in the Tools menu of your copy of Visual Studio.

Bug 153854 - Microsoft Visual Studio (Administrator) (2)

If your copy of Visual Studio does not already have the Library Package Manager (NuGet) extension, you can install it using the instructions in Using the Extension Manager to Install the Library Package Manager (NuGet).

Working with NuGet Packages

You can add, remove, and update packages using either the Add Library Package Reference dialog box or by using PowerShell command-line commands in the Package Manager Console window. The following illustration shows the Add Library Package Reference dialog box. By default, this dialog shows the list of Installed packages. Click on the Online tab to see packages available in the feed.

Add Library Package Reference

The following illustration shows the Package Manager Console window.

package-console

In most cases you can use either method to work with packages. However, some packages create new commands that can only be used in the command-line window. In addition, the Add Library Package Reference dialog box can only be used when a solution is open.

For information about how to use the Add Library Package Reference dialog box, see the following documents:

For information about how to use the Package Manager Console, see the following documents:

For information about how to create NuGet packages yourself, see the following documents:

Related Information

NuGet documentation
Package Manager Console Commands

Last edited Mar 26, 2011 at 8:50 PM by Haacked, version 26

Comments

Pithecanthropus Sep 4, 2011 at 10:16 PM 
I downloaded NuGet today and so far it looks pretty good. I've had some trouble grasping how all the current N* and IoC platforms are supposed to be integrated with the VS IDE. When information comes in the form of blogs rather than straightforward, top-down tutorials, it can be difficult to sort it all out. What I like about NuGet is that it seems to make everything available to you in one place, right from your project if you want.