On Jan 23, 2013, at 11:13 AM, jr1984 <joerg.rohrin...@aon.at> wrote:
> is it possible to load an dll with Assembly.Load when it's in the asset 
> folder?

Should be, though I wouldn't recommend it...

> I have platform specific dll's for windows and android. I tried to use the 
> android specific dll as asset (also in the build action),

Out of curiosity, why?

> but when I try to load it into my app it's not found (i used the path: 
> file:///android_asset/mydll.dll)

That's the problem. mscorlib.dll knows (almost) nothing about Android, nor 
Android-specific things like "file:///android_asset".

If you want to use Assembly.Load(), you'll need to use the 
Assembly.Load(byte[]) overload. (Read the asset into a byte[].)

Now, the problem, and why I can't recommend storing assemblies in Assets (or as 
EmbeddedResources, or anything other than Assembly References):

Linking [0].

The Linker analyzes all "known" assemblies to determine which BCL types and 
members you use, so that the Linker can REMOVE all types and members that you 
don't use.

The problem is that unless the assembly is a Referenced assembly (Project > 
References), or an assembly that is referenced by a Referenced assembly 
(recursively), the linker won't know about it. If the linker doesn't know about 
it, it won't be scanned. If it's not scanned, then types and members it relies 
upon MAY NOT BE PRESERVED.

In Release builds. (Linking is only done in Release builds, so it'll work Just 
Fine™ in Debug builds, then crash and burn horribly in a Release build. Fun!)

This equally applies to assemblies downloaded over the internet. Not 
Recommended™.

So please, for all of our sanity, Do Not store assemblies in Assets, Resources, 
EmbeddedResources, or anything OTHER THAN normal Assembly References (and 
project references).

 - Jon

[0]: http://docs.xamarin.com/Android/Guides/Advanced_Topics/Linking

_______________________________________________
Monodroid mailing list
Monodroid@lists.ximian.com

UNSUBSCRIBE INFORMATION:
http://lists.ximian.com/mailman/listinfo/monodroid

Reply via email to