How to load an assembly dynamically using Assembly.Load on a Windows 8 phone?

Now I have a problem, I want to load the assembly dynamically depending on the platform (x86, ARM). I am creating a _M_ARM compilation conditional character to distinguish between x86 and ARM.

So I use System.Reflection.Assembly.LoadFrom (@ "MP3 / ARM / Mp3EncLib.dll") , but an exception is raised that Assembly.LoadFrom does not support on Windows Phone.

So I use another System.Reflection.Assembly.Load method (@ "MP3 / ARM / Mp3EncLib.dll") , but it throws an exception that

Additional information: Failed to load file or assembly 'MP3 / ARM / Mp3EncLib.dll, Culture = neutral, PublicKeyToken = null or one of its dependencies. The given assembly name or code base is invalid.

private void Application_Launching(object sender, LaunchingEventArgs e)
{
#if _M_ARM
    System.Reflection.Assembly.Load(@"MP3/ARM/Mp3EncLib.dll");
#else 
    System.Reflection.Assembly.Load(@"MP3/X86/Mp3EncLib.dll");
#endif
}

This is my decision enter image description here

Does anyone know how to use this method. Or the best way

+4
source share
2 answers

I believe that you should fully qualify the assembly as SomeCompany.SomeNamespace, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null.

+1
source

Of all that I read on the Internet, this is still not possible even in UWP.

I created a function request here: https://wpdev.uservoice.com/forums/110705-universal-windows-platform/suggestions/18145291-dynamically-load-assembly

, . , , , , DLL AppX .

0

Source: https://habr.com/ru/post/1530944/


All Articles