Prism/Project Linker Support for .XAML Files

Topics: Prism v2 - Silverlight 3, Prism v2 - WPF 3.5
Oct 2, 2009 at 7:37 PM
Edited Oct 2, 2009 at 9:09 PM

I am new to Prism and am wanting to build a user control in Silverlight and then reuse that control in a WPF application.  I tried this and ran into issues with both using Project Linker and just trying the Add Existing as Link command.  After further research, I found that the Project Linker explicitly excludes .xaml files.  Does anybody know how to get around this, or if there is a way of sharing .xaml files between Silverlight and WPF?  I really would prefer to avoid duplicating the code from a maintenance standpoint.

You can find a sample solution at with the build issues I'm running into.


Oct 2, 2009 at 11:07 PM


A possible way to get XAML files included in the linked project is the following (take into account that this is not always a good approach as XAML can be shared across WPF and Silverlight in few occasions):

  1. Link two projects together.
  2. Close you solution.
  3. Open the Target Project using Notepad (or any other text editor). You will find a line like this:
    <UserProperties ProjectLinkReference="a7dc4c1c-bfe1-4820-a821-1b7e37e3e0d0" ProjectLinkerExcludeFilter="\\wpf;\\silverlight;\.wpf;\.silverlight;\.xaml" />
  4. Remove the “\.xaml” filter. The outcome should be <UserProperties ProjectLinkReference="a7dc4c1c-bfe1-4820-a821-1b7e37e3e0d0" ProjectLinkerExcludeFilter="\\wpf;\\silverlight;\.wpf;\.silverlight" />

Now your projects will add project links to XAML files. You should have this issue in mind when using project linker.

Please let me know if this helps.

Damian Schenkelman