Skip to main content

Microsoft Silverlight

Answered Question ".dll as it not built against the Silverlight runtime" Problem.RSS Feed

(0)

mahmut
mahmut

Member

Member

1 points

8 Posts

".dll as it not built against the Silverlight runtime" Problem.

I have multi-tier .NET web application.

My bussiness Layer stays in different .dll assemblies. I read some Silverlight 2 articles and I want to try Silverlight.

I enjoyed very much it. Use Blend studio,   rich design experiences etc.

When I feel that I can shift some of my project to Silverlight I encountered the problem .dll as it not built against the Silverlight runtime. Almost all my bussiness layer was invalid for Silverlight project. I feel very bad.

I've read some posting about using web service for overcome for this problem. But it seems imposible.

I wonder is it impossible to use my current bussines layer in silverlight projects

regards

mahmut esitmez, tr

prujohn
prujohn

Contributor

Contributor

3567 points

703 Posts

Re: ".dll as it not built against the Silverlight runtime" Problem.

Hi.  Glad you are enjoying your first experience with Silverlight.

Silverlight is actually a subset of the .NET 3.5 CLR, running in the web browser (via the Silverlight Control).  Many of the namespaces in the standard CLR were removed.  Some because of security reasons and some because they aren't needed in a client-side environment.  Also some of the libraries were changed so that the underlying code is different for (example) .ToString()

What you can do if you desire, is to slowly migrate your code over, by creating a new Silverlight library and importing your classes one at a time.  One thing you'll come across pretty quickly I suspect, is that your classes are using assemblies that Silverlight does not support.

Using web services to connect your Silverlight client to back-end business layer is a good approach, just takes a bit more planning and implementation to get it working seamlessly.

ccoombs
ccoombs

Contributor

Contributor

5158 points

758 Posts

Re: ".dll as it not built against the Silverlight runtime" Problem.

 your business objects built in regular .net cannot be referenced by a dll import in a silverlight project.  your business objects will have to reside serverside and you HAVE to use WCF or asp web services to reference them.

 i came from a similiar situation where we wanted to use our regular .net business objects in silverlight.  asp web services have been very effective in helping us accomplish that.

mahmut
mahmut

Member

Member

1 points

8 Posts

Re: Re: ".dll as it not built against the Silverlight runtime" Problem.

yes you right John. My old class libraries not suitable to move Silverlight Class Library. Web Service option will be very difficult.

Do you think is this problem can be solved next releases of Silverlight SDK ?

thanks

mahmut esitmez

prujohn
prujohn

Contributor

Contributor

3567 points

703 Posts

Re: Re: ".dll as it not built against the Silverlight runtime" Problem.

Probably not.  It isn't actually a "problem" from Microsoft's perspective, but by design.

From your perspective, it is a problem of course, because you want to do what developers always want to do, which is maximize code reuse whenever possible.  With Silverlight, you're going to have to either 1) Invest some time creating equivalent libraries that are Silverlight libraries, or 2) Invest some time wrapping your .NET libraries in a WCF web service on server-side, and then build the linkage to your Silverlight apps.

ccoombs
ccoombs

Contributor

Contributor

5158 points

758 Posts

Answered Question

Re: Re: Re: ".dll as it not built against the Silverlight runtime" Problem.

if you were wanting to use silverlight and need to retrieve/save information from a database, you would have to develop WCF/ASP web services anyway.

asp web services might actually be a better solution, as you dont have to explicitly define your data contract (as long as you dont need or want to explicitly define which fields will be defined silverlight-side, that is).  the service reference automatically builds the class definitions based on each web method's return types.  no wrapping needed, just define your web methods and the data types used by those methods will be available in your silverlight app.

  • Unanswered Question
  • Answered Question
  • Announcement
Microsoft Communities