HowTo: First Steps with MEF (Hello MEF!)

In nearly every application you can install and use plugins (Firefox, Outlook, IE...). With .NET 4.0 you get a new feature to create extensible applications called "Managed Extensibility Framework" in short "MEF". You can today play with a preview of this upcoming framework. Microsoft itself will use it in Visual Studio 2010 (take a look at the PDC Keynote from Scott Guthrie). A very nice demo of MEF was in the PDC session of Scott Hanselman and his "BabySmash". But there are a lot of other great MEF PDC Sessions.

What´s needed to play with MEF? Everything you needed to start you can download at the Codeplex Site. Just download the newest release and copy the 2 DLLs in your project directory (Disclaimer- it´s still in development, everything might be changed until the release).

At first we search for the "PluginIns" directory and create it if it it´s necessary. Now - pure MEF action:
Plugins are manged with parts and catalogs. We tell our catalog to search for plugins in this assembly: