Aug 23, 2010 at 7:01 PM
Edited Aug 23, 2010 at 7:03 PM
After upgrading my project to the latest release, I started receiving error messages like this when loading a module (this one is actually from the ModularityWithMef quickstart, repro instructions below):
"The composition remains unchanged. The changes were rejected because of the following error(s): The composition produced multiple composition errors, with 10 root causes. The root causes are provided below. Review the CompositionException.Errors property
for more detailed information.
1) Change in exports prevented by non-recomposable import 'Microsoft.Practices.Prism.MefExtensions.Modularity.MefModuleManager.MefXapModuleTypeLoader (ContractName="Microsoft.Practices.Prism.MefExtensions.Modularity.MefXapModuleTypeLoader")' on
I've tracked it down to the fact that my projects have Copy Local set to True on all the Prism/MEF references. When my Shell loads, everything loads correctly. The moment I load a module with the module manager, when the module loading is finished I receive
the above error message.
This can be reproduced easily:
In the ModularityWithMef quickstart sample, change the following references in ModuleB to Copy Local = True:
When ModuleB loads, you'll get the above error.
In the previous drop of Prism, this doesn't happen. You can take the same quickstart sample and change the same references, and it'll work fine.
It makes sense for Copy Local to be False on shared libraries so the XAPs aren't larger than they need to be, however since this is the default value when you browse to a DLL to add a reference, anyone using modularity will encounter this issue. And it's
not an easy issue to track down.