The reason for this article is that I encountered a problem with the dynamic loading assembly, which has been bothering me for a day.
Finally saw this blog: http://www.cnblogs.com/brucebi/archive/2013/05/22/Assembly_Load.html?utm_source=tuicool&utm_ Medium=referral
But not directly to see the original, but here to see: http://www.tuicool.com/articles/a2EN7j
Specifically what reasons can not be loaded, I also do not know, also can not describe clearly, said, even I do not believe.
My project needs are to do the MVC plug-in, from the internet for a long time,
Found it, http://www.cnblogs.com/cjnmy36723/p/3405272.html#3048029.
Found Https://github.com/shiningrise/Plugin.git.
Download the project and run it normally in a human project, but it's not right to run it in my project. Below I describe what is wrong.
According to the introduction of the project, plug-ins can load normally, and the plug-in reference assembly is not loaded, the hint is not found, and is FileNotFoundException, but the file does exist, it should be not loaded into the domain of the assembly.
Very depressed.
The part that is looked out of, is original, in the original project is can, I also specially new a demo, also can.
Very depressed.
Later, on the Internet, I saw the
These two sentences
http://www.tuicool.com/articles/a2EN7j
LoadFile (String)
- The behavior of load and LoadFrom is so complex, and it's not necessarily the assembly that I specify, but what if I'm really sure and sure I want to load an assembly file? That's why there's a loadfile. In fact, there is no loadfile in the. NET Framework 1.0, and because of the reasons mentioned earlier, LoadFile was added to the. NET Framework 1.1.
- dependencies for assemblies loaded with this method are not automatically loaded and can be handled by the Appdomain.assemblyresolve event to handle the loading of the associated assembly.
- LoadFile loads the assembly into the no context, and allows multiple assemblies with the same identity but different paths to exist simultaneously.
Then, replace the program into LoadFrom, miraculously correct, and why is correct, I do not know.
Very depressed.
When using LoadFile, the original project is correct. And it's not right in my own project.
Very depressed. Dynamic loading of assemblies in net