How to easily add open source libraries to .NET projects using NuGet

I have just come across one of the best Visual Studio extensions called NuGet (http://nuget.org/).

It makes it incredibly easy to add available libraries, including such things as JavaScript libraries like jQuery. Not only that, but it will work out any dependencies, download those and then warn you if any get updated.

The easiest way to get going is to add it to Visual Studio using the ‘Extension Manager’ which you will find under the ‘Tools’ menu. It’s called ‘NuGet Package Manager’.

Once installed, it is simplicity itself to add a reference and download the binaries, dependencies and code for a useful library (such as MVVM Light or jQuery).

  1. Right-click on the references folder in your solution.
  2. Select ‘Manage NuGet Packages…’image
  3. and voila…search for new libraries or check for updates. If NuGet finds any updates then you will get an alert when VS2010 starts.

SNAGHTML198fc1

Potential TFS connection Problem TF30063

There is one fly in this ointment that took me a little time to resolve. A bug in NuGet can force the connection to your TFS server to be dropped. The only way out is to restart Visual Studio.  the solution to this turns out to be extremely trivial.

All you need to do is add your TFS server URL to the Intranet security group in Internet Explorer!

The credit for resolving this must go to the very brilliant effort by Miha Markic. See his blog about it at http://blog.rthand.com/post/2011/08/26/Fixing-combination-of-NuGet-and-Team-Foundation-in-workgroup-configuration-401-Unauthorized.aspx

0 thoughts on “How to easily add open source libraries to .NET projects using NuGet

Leave a Reply