Using Native dlls in C# Com wrapper and Use dll in silverlight
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 开发者_JS百科 and Silverlight 4.0
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.
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.
精彩评论