We use SmartAssembly to embed referenced assemblies into a main assembly, so that we only have to deploy this one single main assembly.
Example:
Assembly ABC.dll and Assembly DEF.dll are referenced by the main.dll. That we only have to deploy one main.dll we add ABC.dll and DEF.dll as embedded ressources to one single main.dll with SmartAssembly.
When the resulting main assembly is added into a .Net-project statically everything works fine.
But when the main assembly is loaded dynamically into a customer application (like calling our main.dll from Matlab) the embeded assemblies ABC.dll and DEF.dll can not be resolved anymore.
Following code in a customer application:Assembly mainAssembly = Assembly.LoadFile("PathToMainAssembly\main.dll");
Type mainClassType = mainAssembly.GetType("main.mainClass");
ConstructorInfo mainClassConstructorInfo = mainClassType .GetConstructor(new Type[] { });
object mainClass= mainClassConstructorInfo?.Invoke(null);
Leads to a System.Exception {System.Reflection.TargetInvocationException because the assembly ABC.dll can not be resolved.
Question:
SmartAssembly states the following

So my understanding is when
the main assembly is loaded, then all dependecies should be available for the application domain. But that does not happen.
So what am I missing or missunderstanding?
Is there a simple option i did not check in SmartAssembly?
Is this a generall problem with SmartAssemblies when a combined Assembly is loaded dynamically?
Does anyone knwos a workaround?
Any help would be highly appreciated.
Example:
Assembly ABC.dll and Assembly DEF.dll are referenced by the main.dll. That we only have to deploy one main.dll we add ABC.dll and DEF.dll as embedded ressources to one single main.dll with SmartAssembly.
When the resulting main assembly is added into a .Net-project statically everything works fine.
But when the main assembly is loaded dynamically into a customer application (like calling our main.dll from Matlab) the embeded assemblies ABC.dll and DEF.dll can not be resolved anymore.
Following code in a customer application:
Assembly mainAssembly = Assembly.LoadFile("PathToMainAssembly\main.dll");
Type mainClassType = mainAssembly.GetType("main.mainClass");
ConstructorInfo mainClassConstructorInfo = mainClassType .GetConstructor(new Type[] { });
object mainClass= mainClassConstructorInfo?.Invoke(null);
Leads to a System.Exception {System.Reflection.TargetInvocationException because the assembly ABC.dll can not be resolved.
Question:
SmartAssembly states the following
So my understanding is when the main assembly is loaded, then all dependecies should be available for the application domain. But that does not happen.
So what am I missing or missunderstanding?
Is there a simple option i did not check in SmartAssembly?
Is this a generall problem with SmartAssemblies when a combined Assembly is loaded dynamically?
Does anyone knwos a workaround?
Any help would be highly appreciated.