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?
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:
- Sharing your NuGets
- Uploading Packages To The NuGet Gallery
- Sharing NuGet packages with the world is now just an NuGet.Org away… or The NuGet Gallery and package submission is now live at NuGet.Org!