Visual Studio 2012 and NuGet packages

 

Last year I wrote about installing missing NuGet packages and Visual Studio projects. That works well but it does require using a command line version of NuGet.

 

It turns out that this has become a lot easier in VS2012 and is supported natively from within Visual Studio.

 

Enabling support

The first step is to enable the feature as it is disabled by default. This setting lives under Options -> Package Manager -> General.

settings

 

Restoring missing packages from a VS2012 solution

Assuming you have to restore missing packages for a solution the first thing is to enable this on the project. Right click the solution file and select Enable NuGet Package Restore.

enable-package-restore

Next open the package manager console. There should be a button to restore missing packages. Click this and all missing packages are loaded and the project compiles again.

Package Manager Console

 

Sweet Smile

 

Enjoy!

One thought on “Visual Studio 2012 and NuGet packages

  1. This restore on build has been available since nuget 1.6

    The nuget 2.0 version brought in the Consent setting.

    So all this above is not only 2012, its also availble for some months in vs2010

    See not eon top of this blog post:
    http://blog.davidebbo.com/2011/08/easy-way-to-set-up-nuget-to-restore.html

    Note (12/22/2011): in NuGet 1.6 or later, this feature is built in, so you no longer need to use the NuGetPowerTools. Just right click on the Solution and choose ‘Enable NuGet Package Restore’.

    And On the consent:
    http://blog.nuget.org/20120518/package-restore-and-consent.html

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>