Adding a Library as a Package

With NuGet installed, you can now easily add a library such as ELMAH into your project.

You have two ways to interact with NuGet: the Manage NuGet Packages dialog and the Package Manager Console. I'll cover the dialog first and the console later. You can launch the dialog from within a project by right-clicking the References node in the Solution Explorer, as shown in Figure 10.3. You can also launch it by right-clicking the project name.

The Manage NuGet Packages dialog looks very similar to the Extension Manager dialog, which leads to confusion for some people. The distinction between the two is very clear. The Visual Studio Extension Manager installs extensions that extend and enhance Visual Studio. These extensions are not deployed as part of your application. In contrast, the purpose of NuGet is to install packages that are included in and extend your project. In most cases, the contents of these packages are deployed as part of your application.

Unlike the Extension Manager, the Manage NuGet Packages dialog defaults to the section it was on the last time it was run. Be sure to click the Online node in the left pane to see packages available in the NuGet feed, as shown in Figure 10.4.

Finding Packages

If you're a glutton ...

Get Professional ASP.NET MVC 4 now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.