Im using reflection to invoke a method from a dll, below the source code
ConfigurationObjectsImport configurationObjectsImport;
Assembly asm;
asm = Assembly.LoadFrom("AssemblyName.dll");
object obj;
Type TYP;
TYP = asm.GetType("CustomImport.Import");
obj = Activator.CreateInstance(TYP);
MethodInfo methodInf = obj.GetType().GetMethod("ExecImport");
object[] args = new object[1];
args[0] = configurationObjectsImport;
methodInf.Invoke(obj, args);
The class ConfigurationObjectsImport is duplicated in both current project and in dll with the same space name, but methodInf.Invoke(obj, args); throw an exception "cannot convert type Phenix_Import_Commun.Domaine.ConfigurationObjectsImport to type Phenix_Import_Commun.Domaine.ConfigurationObjectsImport". thanks for helping
Aucun commentaire:
Enregistrer un commentaire