The first step you'll need to take is to install NuGet. Visit the NuGet site, at http://nuget.org/, click on the Install NuGet button, and download the NuGet.Tools.vsix installation file, shown below.
The NuGet Footprint
When you open visual Studio, observe that there is a new menu option on the Tools menu, titled Library Package Manager. This is where you use NuGet. There are two menu options, from the Library Package Manager Menu that you can use: Package Manager Console and Package Manager Settings
Getting a NuGet Package
Selecting Tools -> Library Package Manager -> Package Manager Console opens the Package Manager Console. As you can see, below, the Package Manager Console is text-based and you'll need to type in commands to work with packages.
- References in the project. In Solution Explorer, you no longer see the library in the References folder or the bin folder. (You might have to build the project to see it removed from the bin folder.
- Files in the solution folder. The folder for the package you removed is deleted from the packages folder. If it is the only package you had installed, the packages folder is also deleted.)
- Any changes that were made to your app.config or web.config file are undone.
As explained earlier, clicking Manage Nuget packages…, from the context menu for either a Solution Explorer project or a project's References folder or via the Project menu opens the Manage Nuget packages window. This window will allow you to add a reference a NuGet package in your project.
To the left of the window are a few accordian folders to help you find packages that are either on-line or already installed. Just like the previous section, I'll assume you are installing Nhibernate for the first time, so you would select the Online folder and click All. After waiting for package descriptions to download, you'll notice that there are too many to scroll through in a short period of time. Therefore, use the search box located at the top right corner of the window and type Nhibernate as I've done in the previous figure. You'll see Nhibernate appear in the list. Click the Install button on the Nhibernate entry. If the installation was successful, you'll see a message box display and disappear quickly (or maybe not if your machine is very fast or you blink at that moment).
Then you'll see a reference to the Nhibernate.dll assembly in your project's references list. If you open the Manage Nuget packages window again, you'll see Nhibernate listed in the Recent packages folder.
You can install NuGet via the on-line home page with a click of a button. Nuget provides two ways to work with packages, via console or graphical window. While the graphical window is easiest, the console window is more powerful. You can now quickly add project references to many available packages via the NuGet service.