Skip to content

Converting a Silverlight 4 Prism project to Silverlight 5

January 8, 2012

Problem — You have changed all of your SL4 Prism solution’s projects so that the “Target Silverlight Version” has been changed from Silverlight 4 to Silverlight 5.  This is done in each project’s “Silverlight” properties page.

After this you get compile errors in xaml that use xmlns:prism=”; or that use  <prism:InteractionRequestTrigger and <prism:PopupChildWindowAction.

Here’s the problem and how to fix it. The main obstacle in the SL5 conversion are these two assemblies:

Microsoft.Expression.Interactions and System.Windows.Interactivity

Everything in your SL4 Prism solution that uses the Silverlight 4 versions of these two assemblies, either directly or indirectly, needs to be replaced with the Silverlight 5 versions of them.  This includes all direct references to them in your app’s Visual Studio solution, plus rebuilding the Prism dlls so they too use these references.

Here’s how to do it:

1.  You must have all the SL5 tools and toolkit, plus the Blend 5 SDK installed on your system so that you have access to the SL5 versions of these 2 assemblies.  These are available at the Silverlight site

2.  Download the Prism 4 source code and install it on your system.  Assume you put it in the directory C:\Prism4.  Download at

3.  In Windows Explorer, navigate to the C:\Prism4\PrismLibrary directory of the Prism4 source code.

4.  In PrismLibrary using VisualStudio 2010, go through each project (yes the test projects as well) and delete the reference to these 2 assemblies and replace them with the SL5 versions.  The SL5 versions have Version in the Properties Page.

5.  Then Rebuild the entire PrismLibrary.

6.  Now, copy each of the Prism dlls, and their pdb and xml files from the various bin/Debug subdirs of PrismLibrary to where you keep the Prism dlls that your SL5 Prism app consumes.

  • Note — I find it handy to create a PrismBin solution folder in the SL5 app project that contains Shell.xaml.  Then I copy all the Prism dlls, pdb, and xml files into it and set all project references to these dlls.  This makes it easy to pick up the entire solution and move it to another computer without a lot of work installing Prism on the other system.

7.  In any event, at this point I assume you have successfully installed the SL5 versions of all the Prism binaries somewhere on your system.

8.  Now, open your SL Prism app and systematically go through each project and do the following, making sure to set Copy Local in the properties page for a reference to the way it was before you removed it (Not doing this can cause errors):

  • Remove each reference to both Microsoft.Practices.Prism.Interactivity and Microsoft.Practices.Prism.MefExtensions and replace them with references to the Prism SL5 dlls you built in the previous steps.  Use the Browse tab of the Add Reference dialog window.  P.S. if you want to be extra safe, you can remove and re-add the references to all the Prism dlls.
  • Likewise, remove and re-add the references to Microsoft.Expression.Interactions and System.Windows.Interactivity.  These should show up in the .NET tab of the Add Reference dialog window.

9.  At this point your SL5 Prism solution has all the proper references to the SL5 dlls.  Now run the Clean command for your solution in VisualStudio.  You need to remove ALL of the old SL4 dlls from each bin\Debug directory of each project and Clean should do it.

  • If you get errors running your app, do a Clean then visually inspect the offending project’s bin\Debug directory to make sure there are no lingering old dlls, xaps or manifests.

10.  Now, you solution should build OK and it should also run OK.   If you get exceptions about 1) loading System.Windows.Interactivity or 2) an apparent MEF exception about reflection failing, then you have missed replacing at least one System.Windows.Interactivity dll in your solution.  Replace them with the SL 5 version and it will fix these exceptions.

I developed the above procedure after reading the following thread on the Prism forum at CodePlex  Thanks to the participants in this thread for pointing me in the right direction!

I hope this helps.

George Stevens

Creative Commons License
dotnetsilverlightprism blog by George Stevens is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.
Based on a work at

Leave a Comment

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: