I want to load an assembly at runtime using either a Stream or a Byte array.
In .net you can use Assembly.Load(Byte[], Byte[])
http://msdn.microsoft.com/en-us/library/twt16z2x.aspx
In standard Silverlight you can use AssemblyPart.Load()
http://msdn.microsoft.com/en-us/library/cc190521%28v=VS.96%29.aspx
But in Windows Phone 7 neither of these methods are avaliable.
Well, as you pretty much discovered; you can't do it. The design doesn't allow for you to load an assembly that doesn't ship in your XAP. This is a security design, since they don't want you downloading and running arbitrary code that hasn't passed Marketplace Inspection.
This is on par with how Apple controls its App Store. Why this functionality is not there, and why I doubt it will be added:
What you can do, as OJ suggested in the comments, is make the assemblies as part of your XAP, and use one of the Assembly.Load
overloads that allow you to load it by name. You can dynamically load assemblies, they just have to be a part of your XAP.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With