If you get one thing out of this post, I want it to be that you need to help spread the word on NuGet.
If you are currently using Visual Studio 2010, you have a very powerful package manager at your fingertips. What is a package manager? Well, you know how when you want to use a third party library you have to go find the website, download all of the files, unzip them somewhere (don’t forget to right click and “unprotect” that zip file!), copy them into your project, add references to them, add some configuration, and then you can finally use your library.
Then when a new version comes out (which you probably don’t know about), you have to do the whole thing all over again! It SUCKS. The Ruby guys haven’t had to deal with this for a loooooong time. It has taken a long time for us to get there.
How To Get It
Okay, enough chat, how do you get it? Well, just head over to Visual Studio and click Tools > Extension Manager. Then go to “Online Gallery”. Once you are there, search for NuGet. Then all you have to do is click install:
That is it, you can use it now. And using it is just as easy.
How To Use It
The easiest way to use NuGet is to right click on the project “References” folder and clicking “Add Library Package Reference…”:
This will pop up a box that looks like the Visual Studio Plugins Gallery. Just click the “Online” entry on the left:
And then you will see a list of packages. There is already over 750 packages at the time of writing, with more being added every day (25 today actually).
If you want to add a package, like say the Mongo drivers from 10gen, all I have to do is search for “Mongo” in the top right corner of the dialog and I’ll see a list of packages which match my search:
Then I just click the install button. My references are added just like that (and configuration if the package includes it):
And now when the package is updated, I can simply go back to the NuGet dialog and on the left click the “Updates” option. It will show you all packages that have available updates. All you have to do is click a button to update to the latest version of the package (I don’t have any currently available):
You can also optionally use the console if you don’t want to use the GUI. Just go to Tools > Library Package Manager > Package Manager Console
You’ll then get a console that looks like this:
You’ll have a few commands available to you, like Install-Package. You can even use tab completion which will search online! Check it out:
You can also use Uninstall-Package, Update-Package, or Get-Package. Get-Package is really useful for doing searches:
I hope you see now just how awesome NuGet is, and I hope that you’ll go check it out and spread the word. NuGet has the potential to really help push open source on the .NET platform and at the same time make your life much easier. I highly recommend that you go grab it now.
Loved the article? Hated it? Didn’t even read it?
We’d love to hear from you.