Reputation: 9620
i'm building a Service-Client application using Silverlight and WCF, i have a Model project (which contains POCOs) on the Server side, and i wanted to share those same entities to the Silverlight-Client Application, and i thought, hey! I can change the Model project to be a Silverlight class library, and it should work just fine.
I did the change and now, i'm able to add the references however it is getting the exclamation mark like when the reference is not resolved... and if you take a look at the properties the value of "Resolved" is set to "False", this is causing the following Code Analysis Errors:
CA0058 [CA0001][2]
Please note: this is not the typical question about referencing a Typical Class Library from a Silverlight project (i Know that can't be done), but the other way arround.
Upvotes: 1
Views: 2217
Reputation: 8369
It should work fine (unlike what Wayne says, you can actually reference Silverlight assemblies from projects that target the full .NET Framework). However, you may have references in this project that the full .NET Framework can't load (you generally need to keep your references to the most base types). You've got two alternative options.
Create two class library projects (one targeting Silverlight, the other the .NET Framework), and share the files between them, as I discuss in this article: http://www.silverlightshow.net/items/Building-a-Silverlight-Line-Of-Business-Application-Part-3.aspx
Try out the Portable Library Tools (currently in beta): http://blogs.msdn.com/b/sburke/archive/2011/01/23/3-screen-coding-is-here-portable-library-tools-allow-you-to-target-multiple-net-platforms-with-one-binary.aspx
Hope this helps...
Chris Anderson
Upvotes: 3
Reputation: 6361
For the same reason you can't reference a CLR assembly from a Silverlight project, you can't reference a Silverlight assembly from a CLR project -- they're different runtimes.
Upvotes: 2