This technical article was first published over 2 years ago and may discuss features and approaches that are no longer relevant for the current version of the platform.

NuGet (formerly known as NuPack) is an third party library package management system, heavily integrated with Visual Studio 2010. Its received a lot of attention since Microsoft first announced it, and for good reason. It enables you to simply include third-party libraries into your solution, where NuGet will do all of the heavy lifting and set-up for you.

This can be a real time saver over installing a library manually where you’d have to download the library, unzip it, copy it to your solution, add reference in Visual Studio, and then possibly update the configuration. NuGet offers a better way….

EPiServer developers already have a package manager of sorts via EPiServer’s own Deployment Center – which allows you to deploy pre-made .epimodule or .zip packages to existing sites. This is actually a similar concept to NuGet – but is implemented against IIS sites rather than integrated directly with Visual Studio, and to be honest not many developers go as far as to create deployment modules for their EPiServer contributions.

For me, the great advantage to NuGet is the ability to browse and search multiple package feeds for the latest modules, and then with a single click have them and their dependencies included in your solution. NuGet by default, points to a Microsoft feed (that anybody can contribute packages to), but it can also point to a private feed hosted on a network share or hosted through IIS (using an included Microsoft MVC web application).

This means that along with the main Microsoft public feed you could have:

  1. A company feed of approved packages to be used in standard company ASP.NET solutions.
  2. A public feed of packages specific to a particular product (anybody see what I’m getting at here…..)

So EPiServer, how about setting up your very own NuGet feed? (It’s very simple). Along with the EPiServer code section, this would provide a central and consistent way of searching for and installing new EPiServer modules, rather than the increasing fragmented methods at the minute (within blogs, EPiCode and a growing number of CodePlex projects).

As a small encouragement I’ve put together (the very first) EPiServer NuGet package.

An Example Package

Its very straightforward to create your own package using the tools provided on the codeplex site

I’ve made a NuGet package for every developer’s favourite EPiServer third-party library – Page Type Builder (version 1.3). This is a pretty simple package which includes the two core PageTypeBuilder libraries, and references to two other NuGet packages (Castle.Core and StructureMap) that Page Type Builder depends upon.

I’ve temporarily hosted this package on my blog – so if any of you fancy trying it out, first download and install NuGet, then from within Visual Studio, right-click on your references folder in a solution and click ‘add package reference’. Click settings and add http://www.markeverard.com/nuget/feed.xml as your default package server. Trying to add a package reference will then get you a screen like this…..

PageTypeBuilder package

If you now click the install Page Type Builder, NuGet will automatically download the package and the Castle.Core and StructureMap dependencies and add them to your solution. How easy is that!

NuGet is currently only in CTP, so its still rough around the edges, especially the UI. So if its a bit flakey at the minute then rest assured it will get better. One missing feature is the ability to resolve dependencies from other public feeds, meaning that I’ve also had to host Castle.Core and StructureMap packages rather than using the packages available on the public Microsoft feed.