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.
Small typo in the blog post. There’s no Remove-Package it’s Uninstall-Package
Thanks, Remove-Package was the old command.
Went to add SquishIt to a new project last week via NuGet 😉
@Paul Yeah yeah yeah, I’m getting around to it. 🙂
Nice writeup Justin! I think I’ll put an FAQ up on our site and point to this.
@Peter Sounds good to me! Thanks!
Thanks for the great write-up! 🙂
I went with openwarp due to the implementation. I have not been let down.
I am helping spread the word over at my blog… http://bit.ly/info/eDd4sb
When will SourceGear Vault work with nuget packages? Could it be done better to work with more source control providers? I wish my projects would stop breaking when I try to work with them on another computer…
Cool. Does NuGet offer anything to help when it’s time to install your program on end-user machines?
Nope, NuGet is only for tools distribution, not end user application distribution.
Why is something like NuGet is seen as useful? Why do we want a tool that inserts hidden references and links all over my computer? I just want the dll. I don’t want my PC and project files tampered with.
In any enterprise development environment, dependencies have to be managed as part of the build and deployment system. A ‘convenience’ like NuGet for developers is no convenience at all unless you truly never give your software to anybody else to use.
@Bob W, my thoughts EXACTLY!
I am a minimalist and can’t stand all the needless crap Nuget downloads and sets up.
It always puzzles me how we always complain about “dll hell” and than we introduce this nightmare of the super bloated, super slow, resource eating monster. This “package manager” is exactly the reason why junior programmers should not be in charge of making any kind of decisions, otherwise we will spent all our time cleaning up nightmare solutions from our computer, Nuget is the prime example of such junior thinking