public Assembly LoadAssembly(string assemblyName) //@"D://MyAssembly.dll"
{
m_assembly = Assembly.LoadFrom(assemblyName);
return m_assembly;
}
If I put “MyAssembly.dll” both in D: and its copy in “bin” directory, the method will excute successfully. However, I delete any one of them, it will throw exception. Message like below:
Could not load file or assembly ‘MyAssembly, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null’ or one of its dependencies. The system cannot find the file specified.
I wanna load the assembly which exists in D:. why I need put its copy to “bin” directory at the same time?
Maybe MyAssembly.dll refers to some assembly that arent in the directory. Put all assemblies in the same directory.
Or you can handle AppDomain.CurrentDomain, AssemblyResolve event to load the needed assembly