I'm working an project (pure hobby, "Sharping my skills") which has one unified back-end and multiple front-ends (ASP.NET MVC 1.0/JQuery and Silverlight 2). When I try to add reference to my business layer assembly in the Silverlight 2 project (VS2008); It gets rejected, because it's not a Silverlight assembly.
Is their a way to include and reference a non-Silverlight assembly in a Silverlight app?
No. The source csproj must know it is a Silverlight project. This may mean keeping two project files with the same source ".cs" files. There is a handy csproj trick here - (copied from protobuf-net where I do this for multiple frameworks):
Then you only have to maintain one project; the Silverlight project gets everything from the tree.
Note that the Silverlight BCL is heavily restricted, and not all functionality will be available. Getting code that compiles on both regular .NET and Silverlight can be... challenging.
Alternatively, use proxy classes in the Silverlight app (i.e. via WCF etc). Not as rich, but simple to do.
The short answer is no, I'm afraid. The Silverlight runtime was designed to be a subset of the .NET framework, but the two are not directly compatible. (The runtimes are implemented quite differently, I believe, as Silverlight was designed to be cross-platform.)
The good news however is that you have a whole host of workarounds. This blog post and this CodeProject article discuss the issue in depth and offer a variety of clean solutions. Hope that helps...
The Silverlight runtime is a subset of the main .Net CLR. Although this can seem to be a pain there is a sensible reason for it - the Silverlight runtime needs to be light enough to be a browser plugin.
If you place your other classes behind webservices then they can run under the full .Net runtime while your Silverlight application runs under the cut down CLR in the Browser plugin.