tags:

views:

88

answers:

1

Can a Silverlight application call a method in a full .NET c# class library?

I am trying to add a Silverlight control to my Existing ASP.NET project where i used to add reference to my Business Logic Project and access methods from My UI pages of ASP.NET Web application. Now I have added one Silverlight project to my solution.

How can I use the already existing BL method which is in a C# class library ? When tried to add reference, it is saying that "You can only add project reference to other silver light projects in the solution".

Should i give up ? Is there any way to get rid of this ?

+1  A: 

A common method to achieve this is to build a silverlight library that links in all the files from your Business Logic library. This way the code is written once, and built twice. To link the files go to Add Files in Visual Studio and select the drop-down arrow on the Add button. Select Add as Link.

Alternatively Silverlight 4 and .NET 4 have binary compatible assemblies, so as long as the code in your main Business Logic library is fully Silverlight compatible you should be able to use the library as a reference there.

Simon Steele
Looks like wiered ! I am using 3.5 framework.Rewriting the entire stuff for Silverlight seems to be Bad ! :"(
Shyju