views:

320

answers:

2

I have resources in separate assemblies to be used by multiple WPF apps and this is working fine. Now I am creating a Silverlight 3 app and am trying to use the same assembly to get the same resources. I get an error at the time of adding a reference, saying only Silverlight assemblies can be referenced.
What's the best way for me to do this? Must I have 2 separate sets of assemblies for resources - one for WPF and one for Silverlight? I would not like to maintain two distinct but identical resource assemblies...

Thanks

Note: "link-adding" a file resolved the issue of sharing the same xaml across multiple assemblies. However, to me, one major drawback is that this feature is not supported in Blend 3! Blend keeps trying to find the file locally in the project tree.

A: 

Can you store the resources externally and then use a pre-build step to copy the files into a silverlight assembly that you reference in your project? That was you can avoid having duplicate assemblies and just change the resources in a single location.

Stuart Thompson
That would possibly remove all syntax-highlighting and Visual studio build processes so using VS would be extremely difficult. If you use TFS you could link files into different repository folders.
Russell
+3  A: 

Unfortunately, .NET assemblies cannot be referenced from a Silverlight app.

For details and possible solutions, see http://www.pagebrooks.com/archive/2008/10/11/sharing-code-between-.net-and-silverlight-platforms.aspx.

Igor ostrovsky
Thanks. The link you provided helped me. However link-adding a file does not work in Blend. I mean, it works but not in design-time.
Gustavo Cavalcanti