Think NuGet is only for Visual Studio (or IDE)? Think again...


You've heard me, and many others, gush on and on about NuGet. How it's a watershed moment in .Net development, how it makes adding and using additional libraries in our Projects almost too simple. Yeah, that's very cool and all that, but what if you could harness the power of NuGet inside your own app? That instead of the target being Visual Studio it's your app, not source code project but application, that gets to ride the NuGet tiger? Melding the NuGet with VS Extension Manager like features into something unique for you and your app?

Today's post comes via Jason Haley's Interesting Finds: June 20, 2011 and does just that. It's a project that uses NuGet's features and infrastructure to add a painless add-in/extension feature. Oh, you think I mean MEF? That's one part, but only one part. How do your users distribute their plug-ins? How are they downloaded and consumed? Discovered and managed? Upgraded?

Matt Hamilton has thought about it and shared his idea and code, Using NuGet for Application Plug-Ins

Comicster now uses NuGet to manage its plug-ins and skins (which I collectively call "extensions"). Using NuGet in your own application is easy! Let's go through the core parts:

First you'll need a reference to NuGet.Core. You can install this using NuGet itself, but be aware that as of this writing (version 1.4) the assembly is only for the full .NET Framework "extended profile" - Client Profile applications won't build if you use NuGet.Core. I'm currently using a custom build of the assembly until version 1.5 is released.


BTW Comicster is a free and source available application written by Matt that helps you manage and catalog your comic collection.

The next post, NuGet with MEF, continues to extend the concept and implementation.

Now that we have the basics of installing and uninstalling NuGet packages, the next step is integrating the contents of those packages into our application.

Comicster has two kinds of extensions: Skins and Plug-Ins. A skin is just a loose XAML file and any associated content, while a plug-in is one or more assemblies containing classes that implement one or more exported interfaces from Comicster.Core.DLL.


I just dig the idea of leveraging NuGet, and MEF of course, to add extensibility to our apps. Why deal with all that ick when what you really want to do is focus on your app? NuGet is a great wheel, and one that doesn't need to be re-invented for our apps...

If you're writing extensible apps, or apps that have add-ins, etc, you might take a good long look at this...


Here’s a few more links you might find interesting:


Page thumbnail, Bright eyed, curtsey of tourist_on_earth

The Discussion

  • User profile image

    I want LINQPad to have NuGet integration. Specifically that its script XML format is changed to a package format a la a zip'd archive of XML and DLL files so that a script is more or less fully self-contained with package information and DLL files included.

Conversation locked

This conversation has been locked by the site admins. No new comments can be made.