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: