651.288.7000 info@intertech.com

Greetings! I decided to make a simple blog post about NuGet because I feel Microsoft hasn’t been extremely clear defining the two main ways that developers use it with Visual Studio. Starting with Visual Studio 2010, Microsoft created NuGet as a new deployment utility that allows you to install custom software either as a Visual Studio modification or as a way to add software to a Visual Studio project.

For Visual Studio 2010, you need to download and install the NuGet platform. For Visual Studio 2012, Visual Studio 2013, and newer, it is included with the Integrated Development Environment (IDE).

Modifying Visual Studio

The NuGet Package Manager will allow you to install, update, and uninstall software to Visual Studio itself or to an existing Visual Studio project. To modify Visual Studio, simply start Visual Studio and then, before you open any solutions/projects, click Tools | Extensions and Updates… This opens the Extensions and Updates dialog box.

There are three sections to this dialog that (in my opinion) aren’t clearly laid out. On the left side, you can click Installed, Online and Updates to choose what kind of information you want to see. In the middle of the dialog are the results based on the filter you clicked on the left side. On the right is a Search box and detailed information with links to the selected item on the Visual Studio Gallery website.

Below, the dialog is showing a list of all the packages that are already installed the machine. Note that this is just a few of the installed packages. There is a scroll bar on the right side.


If you want to install a new package to modify Visual Studio, click the Online tab on the left side. If you know the name of the package, you can enter it into the Search box to filter the results. If you want to learn more about the item before installing it, just click one of the links (such as Release Notes) in the item’s description.

Below, I wanted a Visual Studio extension that would generate proxy classes via a T4 template for OData communications. As you can see, I clicked Online on the left side and searched for OData to find the NuGet package.


Once downloaded, installed, and Visual Studio has been restarted, this template is now available for use within any Visual Studio project.


Modifying a Visual Studio Project

Alternately, you may want to consider adding a library or plug-in into one of you project. The easiest way to do this is by using NuGet, of course! After you’ve after opened a solution with at least one project, you can install a library into your project by right-clicking the References folder and clicking Manage NuGet Packages… Note its icon that looks like a black and white Christmas present.


This dialog may look the same as the other one but it is not. This dialog box shows you the packages that are installed in the selected project – not the packages installed in Visual Studio. If you create a new non-empty project in Visual Studio, you may find that it already includes a bunch of NuGet packages by default. For example, the new project that was just created (MvcPubs5) already includes 28 NuGet packages! It automatically downloaded the latest NuGet packages from the NuGet servers when with the project was created. This ensures that you always have the latest software. Visual Studio actually uses OData requests to the NuGet servers to get the latest packages.

Some packages depend on other NuGet packages. For example, the WebGrease package (Microsoft’ web optimization library) depends on the Antlr and JSON packages and will automatically be included when installed.


Note that the software on the NuGet servers may not always be up to date with the software publishers. For example, the jQuery library v1.11.1 was released on May 1st, 2014. However, at the time of writing (May 8, 2014), NuGet only includes versions up to jQuery v1.11.0. As well, if you go to the Update tab, it immediately assumes you want the v2.x version of jQuery, which is another story. See here for details: http://jquery.com/browser-support/

When new packages are installed, the reference(s) will be added automatically to the web project and the package will be registered in packages.config. As well, all required entries in app.config or web.config will automatically be added. This is extremely convenient!

Sometimes the newer versions of packages actually break compatibility with older libraries. For example, Entity Framework 6 does not work well with ASP.NET MVC 4 scaffolding. You must install EF 5 instead. If you ever wish to install an older version of any package, just look up the package on http://www.nuget.org/. Here you will find the exact PowerShell (PS) installation command to install any version you’d like. Here is the page for EF 5.


To run this PS command, simple copy the text from the black window to the clipboard, open the Package Manager Console, and paste it in to install it.

2014-05-08_15-42-06 2014-05-08_15-43-34

You can easily install your packages to NuGet for free as well. To learn more about NuGet, check out this humorous and inspiring video with Scott Hanselman and Phil Haack – one of the original NuGet developers. http://channel9.msdn.com/Events/MIX/MIX11/FRM09

Best wishes to you!