There is a big problem in C # AppDomain.
I need to load a static class into a DLL file and execute its method:
When I try to download them using
Assembly.LoadFrom("XXXXX") // (XXXXX is the full path of dll)
.dll will not be downloaded automatically or programmatically.
When I try to load them into AppDomain, for example
adapterDomain = AppDomain.CreateDomain("AdapterDomain"); (a)adapterDomain.CreateInstanceFrom(this.AdapterFilePath, this.AdapterFullName); (b)adapterAssembly=adapterDomain.Load(AssemblyName.GetAssemblyName(this.AdapterFilePath));
If I use method (a) because the target class is static, it does not work.
If I use method (b) because the target .dll is not the same directory with my project, I will get an exception.
How to load a DLL file and a static class, and then unload the DLL after my use?
source share