Copy Load Set to False Issue

Topics: Prism v4 - Silverlight 4
Oct 30, 2010 at 5:36 PM

I am using Drop 10  to get a basic module loaded and am getting the following error:

"If this error occurred when using MEF in a Silverlight application, please ensure that the CopyLocal property of the reference to the MefExtensions assembly is set to true in the main application/shell and false in all other assemblies."

I have set all assemblies, other than the main shell, copy load to false, but am still getting the error. If anybody has any suggestions it would be appreciated.

 

<m:ModuleCatalog xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"     xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"    xmlns:sys="clr-namespace:System; assembly=mscorlib"    xmlns:m="clr-namespace:Microsoft.Practices.Prism.Modularity;assembly=Microsoft.Practices.Prism">     

    <m:ModuleInfoGroup Ref="ModuleB.xap" InitializationMode="OnDemand">        

<m:ModuleInfo ModuleName="ModuleB" ModuleType="ModuleB.ModuleB, ModuleB, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null" />    

   </m:ModuleInfoGroup>

</m:ModuleCatalog>

 

Bootstrapper.cs

 

 protected override IModuleCatalog CreateModuleCatalog()        {          

  // When using MEF, the existing Prism ModuleCatalog is still the place to configure modules via configuration files.            

return Modularity.ModuleCatalog.CreateFromXaml(new Uri("/Simplify;component/ModulesCatalog.xaml", UriKind.Relative));        

}

Nov 2, 2010 at 3:18 PM

Hi,

If you are using MEF the assembly that you must set with Copy Local False is the Microsoft.Practices.Prism.MefExtensions assembly. For more information about this, you could take a look at the following documentation section in the Prism4.chm:

  • Chapter 4: Modular Application Development, see the Preparing a Module for remote download using MEF section.

On the other hand, in the ModuleCatalog.xaml you could try with the following configuration:

<m:ModuleInfoGroup Ref="ModuleB.xap" InitializationMode="OnDemand">
<
m:ModuleInfo ModuleName="ModuleB"/>
</
m:ModuleInfoGroup>

Then your ModuleExport attribute must be similar to the following:

[ModuleExport(typeof(ModuleB))]

Please take into account that the module name must be equal to the exported type (ModuleB).

If you continue experiencing this problem, could you please share a repro sample?

Hope this helps.

Fernando Antivero
http://blogs.southworks.net/fantivero