Avoid error message: "Failed to load type for module...The composition remains unchanged"


  • Hello,

    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.

    Saturday, July 23, 2011 2:28 AM

All replies

  • hi,


    My code is working fine on my machine but facing same issue in output published by teambuild. It is observed that size of xap files is different in both cases(code published on my machine and code published by teambuild).



    Tuesday, October 25, 2011 3:29 PM
  • good solution, your post is just helpful.

    thank you very much


    Thursday, November 10, 2011 7:47 AM
  • Thanks a lot!!! I didn't knew what went wrong....I was working on this issue more than an hour.....

    Wednesday, February 15, 2012 9:07 AM
  • 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...
    Friday, November 04, 2016 12:41 PM