Pappu
Pappu

Reputation: 93

is there any way to add non silverlight assembly to a silverlight project?

I want to add non-silverlight assembly to a silverlight project, is there any way to do this? or what will be the other option to do ?

Upvotes: 1

Views: 157

Answers (2)

Luke Woodward
Luke Woodward

Reputation: 64949

As Andrey writes, it's impossible to add a non-Silverlight assembly to a Silverlight project. If you really need to use it, you have no option but to run it server-side. You may already have a Web project that goes with the Silverlight project, and if so, that's where you should add a reference to this assembly.

The technology used to make remote calls from Silverlight to the web project is WCF RIA Services. The page I linked to contains plenty of documentation and videos to help you learn about WCF RIA Services.

There are, however, a few situations in which this approach won't work. Perhaps none of them apply to your circumstances, but since you don't provide any details about this assembly, I can't be sure.

  • If, for example, your assembly contains some WPF controls and you want to add them to your Silverlight application, you're out of luck. You'll have to find Silverlight-specific equivalents.
  • If you'll be calling this assembly frequently, you might find your Silverlight application spending a lot of time waiting for the server to respond. This could slow your application down significantly.
  • If your application needs to be able to run out-of-the-browser and disconnected from the internet (a requirement of my current Silverlight project), you will also be out of luck.

There are a number of things that I can think of that should work reasonably well over WCF RIA Services:

  • sending email, calling web services or various other network-related activities,
  • talking to a database,
  • mathematical calculations.

Upvotes: 1

Andrey
Andrey

Reputation: 60055

It is impossible because Silverlight has different runtime from full .net framework. The common way to solve it is to create WCF service that will have access to that assembly and provide remote access for Silverlight application.

Upvotes: 1

Related Questions