Failed to Load file or assembly "Dal" or another dependency, the system cannot find the specified file

Source: Internet
Author: User

To solve this problem, I am typing VB. the net data room charging system appears twice in total. The first time was when reflection + Abstract Factory was used, the second occurs when you use the package tool that comes with vs2012 to generate an executable file and execute the EXE file. For details, see:

First time:

Second:


 

Before solving these two problems, we must first understand the principle that there is a direct or indirect relationship between all layers in any solution we have established. Take the relationship between my IDC charging system:


 

 

As shown in "generate" of the U layer (Windows form, if it is a startup Item,


The figure shows that the U layer does not generate the DLL (dynamic link library file) of the D Layer at all. The reason is that the reference relationship is in turn restricted: The U layer is the startup item, and he and fa c Ade
Bllabstractfactory and idal are sequential references, while dal and U layers are not sequential references. Suppose we change the reference relationship between idal and Dal to idal to reference Dal. In this way, when we run the U layer, the debug file will have all our DLL files. If you do not know why DLL files are required, go to the encyclopedia and I will not go into details here.

First, it is clear that the U layer is the startup Item. When we start the solution, we can choose "UI Layer"> "compile"> "generate output path" (as shown in) the folder must contain all the projects we want to use. Otherwise, the Assembly cannot be found.

 

Through the above explanation, we know the relationship between the project and the project, and we can know that the reference relationship between the project and the project is not sequential, to solve the problem of an error in the startup solution, copy the DLL file of the missing project to the "compile"-"generate output path" folder of the startup Item. This solves the error where the Assembly cannot be found.

The solution to my problems is as follows:

It is certain that the D Layer does not have a reference relationship with the U layer in sequence. We need to manually add the DLL file.

For the first time: copy the DLL file of layer d
In the debug folder of the U layer.

The second time: When I add the main output of the UI Layer
Dal. dll:


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.