ConfigureRegionAdapterMappings crash in Silverlight 5

Sep 29, 2011 at 12:39 PM

I'm creating an application silverlight 5 using prism 4 and when I'm running the bootstrapper using UnityBootstrapper then I have the next error:

Could not load file or assembly 'System.Windows.Controls, Version=2.0.5.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified.

This error in the ConfigureRegionAdapterMappings method:

    protected override RegionAdapterMappings ConfigureRegionAdapterMappings() 
   
{ 
       
// Call base method 
       
var mappings = base.ConfigureRegionAdapterMappings(); <-- I get the error here! 
       
if (mappings == null) return null; 
 
       
// Add custom mappings 
 
       
// Set return value 
       
return mappings; 
   
} 

The strange thing is if I change my project to silverlight 4 then it is working fine (?). Could you please help me?

Thanks!

Developer
Sep 29, 2011 at 7:28 PM

Hi,

You could check if the prism library assemblies/project you're using are being compiled for Silverlight 5.

By default your Silverlight 5 projects reference to System.Windows.Controls assembly should be: 

.\Program Files (x86)\Microsoft SDKs\Silverlight\v5.0\Libraries\Client\System.Windows.Controls.dll

To avoid version conflicts, Prism Library projects should use the same reference.

You might find the following thread useful, where a similar issue is addressed:

There you can find a sample which portrays the aforementioned modifications.

I hope you find this useful.

Agustin Adami
http://blogs.southworks.net/aadami