Assembly. Load () cannot load the Assembly

Source: Internet
Author: User

"Failed to Load file orProgramSet "com. sqlserverdal" or one of its dependencies. The system cannot find the specified file. Is unable to find the Assembly, mainly because it does not understand its running mechanism, in fact, if
Assembly. Load (PATH). createinstance (classname );
Write
Assembly. Load ("com. sqlserverdal. dll"). createinstance (classname );
This is not a namespace, but a DLL file in the bin. The default DLL file generated by the project sqlserverdal is sqlserverdal. dll, so the above error occurs. You only need to change the Assembly name to "com. sqlserverdal" in the project attribute.

========================================================== ========================================================== ==============================

Error Description: failed to Load file, assembly "sqlserverdal", or one of its dependencies. The file does not exist.

Cause: 1. The understanding of dynamic reflection is unclear when using hierarchical design ideas.

2. Failed to load the Assembly due to a bug in the development tool.

Solution:

1. Reflection programming requires that the compiled. dll file (that is, the DLL file exists) be included in the bin folder of the website, and the name of the class library must be consistent with that of the class library before compilation. It can be called "add reference.

2. check the properties of the project (Class Library) on the website, and check whether the default namespace is consistent with the Assembly name and the DLL file name in the bin folder. Otherwise, the file or assembly cannot be loaded, so modify the properties of the project. Name consistency.

3. It is recommended that you write the system name + project name when creating a class library during programming to effectively avoid generating bugs. That is, systemname. model or systemname. idal. Eg: BBS. model. It can be called: Name integrity.

 

Most important: the path dll must be in the bin directory of the website Web

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.