Gus
Gus

Reputation: 10659

Resources for both WPF and Silverlight in the same assembly

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.

Upvotes: 3

Views: 597

Answers (2)

Igor ostrovsky
Igor ostrovsky

Reputation: 7392

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.

Upvotes: 3

Stuart Thompson
Stuart Thompson

Reputation: 1859

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.

Upvotes: 0

Related Questions