Introduction to NuGet

February 4, 2013

NuGet is a package management system for Microsoft .NET and Visual Studio. It allows you to create simple and/or complex packages that install files into your projects, adds references and make any necessary configuration changes if needed. It also allows you to easily update to a newer version of the package if it’s available, or completely remove the package.

What is NuGet

“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 install the package, NuGet copies files to your solution and automatically makes whatever changes are needed, such as adding references and changing your app.config or web.config file. If you decide to remove the library, NuGet removes files and reverses whatever changes it made in your project so that no clutter is left.”

What is a NuGet Package

“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.”

NuGet User Interface in Visual Studio

“NuGet runs in all versions of Visual Studio 2012, as well as Visual Studio 2010, Visual Web Developer 2010, and Windows Phone Developer Tools 7.1. You can find, install, remove, and update packages by using the Manage NuGet Packages dialog box or by using PowerShell command-line commands in the Package Manager Console 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 Manage NuGet Packages Dialog Box

The following illustration shows the Manage NuGet Packages dialog box. You can access this by right clicking on your project in the Solution Explorer and then click on the Manage NuGet Packages… menu item.

sshot-409

The Manage NuGet Packages Console Window

The following illustration shows the Package Manager Console in Visual Studio. This console window lets you run NuGet PowerShell commands.

sshot-410

Supported Operating Systems

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

Now that we have an idea of what NuGet is, let’s try it out.

Getting Started

To get started, you will need to download and install NuGet. Launch Visual Studio and then go to the Tools menu, then select the Extensions and Updates… menu item.

sshot-411

Then in the Online section, search for NuGet Package Manager or usually this is listed as one of the top items in the Visual Studio Gallery section.

Once NuGet Package Manager is selected, press the Download button. After a package has been downloaded and installed, you will see a green checkmark as illustrated below:

sshot-412

When the installation is complete, you will need to restart Visual Studio.

After Visual Studio is restarted, NuGet will then be ready for use.

NuGet is truly a pain-free way of installing and managing packages for your projects. NuGet takes care of everything and it just works!

Further Reading

  1. Managing NuGet Packages using the dialog. This describes in great detail how to find, install, update and remove packages from your project and/or solution.

    The solution option is neat as you simply select which projects you want to add the package to and then they’re all installed/updated at once.

  2. Creating and Publishing a Package.

References

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

toon vanhoutte

Blogging about connecting devices, systems and people! On-premises and in the cloud. Microsoft stack only.

Ken Cenerelli

My life in software development

scomfaq.wordpress.com/

Things about System Center and Cloud...

Build HoloLens

All about HoloLens

DevDays®

For web designers and cloud developers

Build Azure

All about the Microsoft Cloud

vishal patel

Software Developer, Windows 8 and Windows Phone Enthusiast

SQL with Manoj

SQL Server (TSQL) Programming, DB concepts, Tips & Tricks with >400 articles... comments welcome!!!

dragablz.wordpress.com/

Dragable, tearable, dockable WPF TabControl. Open source to boot.

Adrian Hall

Because Developers are Awesome

Ratish Philip's Blog

Another adventure in code...

codematrix

Application Architecture at it's best

One Unicorn

Thoughts from one member of the Entity Framework team...

Rachel Lim's Blog

Simplifying programming into something I can understand

.NET Developer's Blog

Software Development, Flying and Life

The Flying Maverick

Software Development, Flying and Life

Hiking Photography

Beautiful photos of hiking and other outdoor adventures.

paint.net blog

The best free image and photo editor. By Rick Brewster.

Learning by Shipping

products, development, management...

%d bloggers like this: