Introducing NuGet: the smart way to bring bits into your projects

I’m thrilled to announce that the secret project we’ve been working on for the last few months is no longer a secret!  It’s called NuGet, and you can download it from here.  Make sure you also read ScottGu’s post about it.

So what the heck is NuGet?  In short, it’s an Open Source package manager that lets you import libraries into your .NET applications with much less effort than what you’re used to.  Note that NuGet is not a Microsoft project, but an Outercurve Foundation project (previously Codeplex Foundation).  It has both Microsoft and non-Microsoft contributors, and is run as a true Open Source project.  See for more info on this.


What problem is NuGet solving exactly?


If you’re a .NET programmer, you’ve likely experienced the pain of getting a 3rd party library into your project.  It usually goes something like this:

  1. You know what it’s called, but you have no idea where it lives, so you search for it in your favorite engine.  You often find multiple pages that could legitimately be the want you want.
  2. You look around the main page for a link to the download page.
  3. Once on the download page, you’re often presented with way more choices than you’d like: several builds, for several platforms, …
  4. You download a zip file that you then unzip somewhere on your machine (after remembering to ‘unblock’ it in Windows!).
  5. You copy the relevant assemblies into some folder in your solution.
  6. In VS, you add a reference to the assemblies.
  7. In some cases, you need to make changes to your web.config file to properly enable the component.  This is quite non-trivial if you’re not familiar with it.

Needless to say, all of that is pretty painful and error prone.  Sure, once you’re familiar with a library, you’d probably just copy it from another project instead of getting it from the web, which makes things a bit easier.  But it’s still an overall very ad-hoc process.

And that doesn’t even cover the common case where a library has a dependency on some other libraries, which raises the complexity to the next level.


NuGet to the rescue!


With NuGet, you get a PowerShell window directly in Visual Studio.  You just type a simple command like ‘Add-Package CoolLibrary’, and it takes care of everything.  You can also right click on References and choose ‘Add Package Reference’ to do the same thing through a dialog.  It’s all very very easy, and it just works!

But instead of giving you all the details in writing, I put together a screen cast that shows NuGet in action!  It’s 14 minutes long, so a little bit on the long side, but it demonstrates using NuGet to install all kind of libraries into an MVC 3 app, so it’s pretty action pack.  If that doesn’t convince you of the awesomeness of NuGet, then I will have failed :)

Note: to watch it optimally, you can click on it a second time to view it directly in YouTube.  In there, change it to 720p and play it in full screen.

Another small note is that I made this video with a slightly older build, so you will see some small UI differences with the public bits.


NuPack in Action


I’ll be blogging some more about NuGet in the coming days, so stay tuned!