About the projects of multiple items in vs.net and multiple DLL references!

xiaoxiao2021-03-06  53

In a Web solution for VS.NET, there may be many projects in a solution, except for the "Formation Layer (UI) Project", other projects are DLL projects. If the DLL is quoted between the various projects, the reference conflicts between DLL often occur, resulting in the engineering that cannot be compiled. There can be two kinds of solutions:

1. If all the projects are placed in a large solution, then set the project's compilation order. Compile only the engineering of the system DLL, there are always some projects, just quote system, system.data, system.xml, etc., these projects are compiled. The class is pushed, referenced to the next step of the DLL of the DLL, one step by step ... until the last project. How to set the engine compilation order? Right-click on the "Solution" icon -> "Project Dependen", set the dependence project of each project, in "Project Generation Order", the project's compilation order is automatically adjusted, so There will be no problem with the DLL conflict when compiling! The advantage of this method is that every time you compile it, you can compile all the projects to ensure that the files checked out from the VSS can be compiled. The disadvantage is that if you compile a big solution, you have to have a long time!

2. Compile each work separately and output the DLL to the same specified directory, all projects reference the DLL under the referendency. If you open more than 2 VS.NETs and mutual projects, it is possible to compile, the system will report an error, saying that the specified DLL is being occupied.

The way to do is: a. Specify the output directory, right-click "Generation", "Output" in the Project Icon -> "Output", set the output path, and put it in "General Properties" Error DLL reference path deletion in "Reference Path". B. Do not copy the referenced DLL to the local directory. Put the project reference DLL all selected, "Copy Local" in the properties is set to false, and "variables have been repeatedly defined" in the case. Mainly, for the UI layer project (that is, the project can be run), you must copy all the DLLs referenced by all the projects into its bin directory, because "can run the project" will only look for DLLs in the bin directory at runtime. If there is no, I will report the runtime error of the DLL! The advantage of this approach is that each project group only recompacked its own DLL, then submitted to the configuration administrator, compiling the entire solution by the configuration administrator, and the speed is faster. The disadvantage is that if a project group only updates the source code file, there is no submitted DLL, then it is not the latest DLL in the solution.

The above two methods can solve the problem of reference to collisions between DLLs!

转载请注明原文地址:https://www.9cbs.com/read-114220.html

New Post(0)