I got loading problem and can't resolve it. The Error I got is as follows:Could not load file or assembly 'BuildTest, Version=1.0.0.4, Culture=neutral, PublicKeyToken=null' or one of its dependencies. The system cannot find the file specified.":"BuildTest, Version=1.0.0.4, Culture=neutral, PublicKeyToken=null"
The code I wrote is as follows:
var buildTestPath = @"D:\BuildTest\bin\Debug";
AppDomainSetup setup = new AppDomainSetup();
setup.ApplicationName = "BuildTest";
setup.ShadowCopyFiles = "true";
setup.PrivateBinPath = buildTestPath;
AppDomain domain = AppDomain.CreateDomain("MyDomain", AppDomain.CurrentDomain.Evidence, setup);
var assemblyFile = Path.Combine(buildTestPath, "BuildTest.dll");
var assemblyName = AssemblyName.GetAssemblyName(assemblyFile);
var assembly = domain.Load(assemblyName);
Type myType = assembly.GetType("BuildTest.Class1");
MethodInfo myMethod = myType.GetMethod("MethodA");
object obj = Activator.CreateInstance(myType);
myMethod.Invoke(obj, null);
AppDomain.Unload(domain);
Could anyone help me out?
Thanks
Aucun commentaire:
Enregistrer un commentaire