Ever tried to work through an example, did every step consiously and yet... an error occurs. For example this one:
Failed to load type for module MyModuleName. Error was: the composition remains unchanged. The changes were rejected because of the following error(s): The composition producesd multiple composition errors, with # root causes. The root causes are provided below. Review the CompositionException.Errors propery for more information.
Then follows a list of errors, and none of them points out clearly what went wrong. And the solution is very simple, but crucial to sort out right.
It is this: in the module you want to have composed, you have set references to "Microsoft.Practices.Prism.MefExtensions.dll" and to "Microsoft.Practices.Prism.dll". When you reference these, they are automatically set to "Copy Local=True" in their properties. These two references have to be changed into "Copy Local=False".
Recompile and voila: your application (MEF) composes like you hoped it would!
Please mark as "answer" if you found this useful.
Hi! I am getting this error and tried to do what you specified, but still the same issue. However, in my references I don't have the Microsoft.Practices.Prism.dll" library, I have "Microsoft.Practices.Prism.Composition", "Microsoft.Practices.Prism.Interactivity", "Microsoft.Practices.Prism.MefExtensions", "Microsoft.Practices.Prism.Mvvm", "Microsoft.Practices.Prism.Mvvm.Desktop", , "Microsoft.Practices.Prism.PubSubEvents", "Microsoft.Practices.Prism.SharedInterfaces" and so on...