Very depressed. Dynamic loading of assemblies in net

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.