3

As part of my project I need to use some Unamanged code dlls in Silverlight. If I wrap these unmanaged dlls in a C# dll will I be able to access the native dlls from silverlight. I use Visual Studio 2010 and Silverlight 4.0

2 Answers 2

9

With Silverlight 4, you can call out to COM objects installed on the local machine. However to do this the user has to choose to allow the Silverlight App full access to their machine.

In addition the COM object needs to already be installed on the machine. Therefore the user would first have to separately download and install your DLLs before using any features that relied on them in your Silverlight application.

Sign up to request clarification or add additional context in comments.

2 Comments

+1, it should also be noted that not only does the app need full trust, but it also needs to be running Out of Browser.
Silverlight 5 will have in-browser calls to COM if your XAP is trusted. microsoft.com/silverlight/future
0

Silverlight runs in the browser sandbox so it wont allow you to call directly to unmanaged assembly. Eventhough you wrap the unmanaged code in a C# assembly, it still get loaded within the same app domain that is restricted by the same security restriction.

I have read that you can use html interoperability between silverlight and ActiveX, but I haven't experienced it myself. Alternatively, you can deploy the complete WPF application and if you sign it with appropriate certificate and security setting, it can access unmanaged code - if this is an option.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.