Is MEF compatible with the article "WPF Hands-On Lab: Get Started with the Prism Library" ?

Topics: Prism v4 - WPF 4
May 19, 2013 at 12:48 PM
Edited May 19, 2013 at 12:56 PM
Follow the instruction in, I create a WPF application.

Every thing was OK as the article said.

The article said: "This hands-on lab uses the Unity container, but you can also use the Managed Extensibility Framework (MEF) with the Prism Library."

Now I want to use MEF instead of Unity. So I
  1. added
    reference to Microsoft.Practices.Prism.MefExtensions
  2. added
    using Microsoft.Practices.Prism.MefExtensions;
  3. modify
    class Bootstrapper:UnityBootstrapper
    class Bootstrapper:MefBootstrapper
Then I got the ModuleTypeLoaderNotFoundException with message:
"There is currently no moduleTypeLoader in the ModuleManager that can retrieve the specified module."

How to fix it ?
May 20, 2013 at 5:37 PM

Since Unity and MEF work different, you will need to do some modifications to the code, i.e. the way you declare Modules, so that your application can work with MEF. Changing the references is just the first step. To understand how you can make those changes, you can always check Prism documentation, since each of the documentation sections describes how to implement the same code with both Unity and MEF containers:


Federico Martinez
May 21, 2013 at 6:06 AM

Thanks, now I know that the answer is in the following two link.

3: Managing Dependencies Between Components
4: Modular Application Development