I have two assemblies (one dependent on another) that need to be loaded dynamically. I also have a certain version of the two assemblies referenced in the project, but a different version than this version should be executed depending on the assemblies loaded. How can I make sure that the executed code comes from the dynamically loaded assemblies and not from the static references in the project?
Here's some pseudo-code of what I'm trying to do:
Assembly assembly1 = Assembly.LoadFile( @"c:\assembly1.dll" );
Assembly assembly2 = Assembly.LoadFile( @"c:\assembly2.dll" );
Assembly2Type a2 = (Assembly2Type)assembly1.C
reateInsta
nce( "Assembly1TypeFullName" );
CreateInstance does seem to create the right type, but Assembly2Type seems to used the project-referenced version of the assembly instead of the dynamically loaded assembly.
Thanks
Start Free Trial