For more information about the project references and DLL references of multiple projects in vs. net!

Source: Internet
Author: User

In vs. NET Web Solutions, a solution may contain many projects, except for the "presentation layer (UI Layer) Project", and other projects are DLL projects. If any DLL is referenced between projects, a reference conflict often occurs between them, resulting in the project being unable to be compiled. There are two solutions:

1. If you put all the projects in a large solution, you need to set the compilation sequence of the project.

Compile the project that only references the system DLL first. There are always some projects, but reference system DLL such as system, system. Data, and system. xml. These projects are compiled first. And so on, reference the above compiled DLL project and then compile it one step ...... Until the last project.
How to set the compilation sequence of the project? Right-click the "solution" icon-> "project dependency... ", set the dependent projects for each project. In the" Project generation sequence ", the project compilation sequence is automatically adjusted, in this way, DLL conflicts will not occur during compilation!
The advantage of this method is that all projects can be compiled every time you compile it, ensuring that all files checked out from VSS can be compiled. The disadvantage is that it takes n long to compile a large solution!

2. compile each project separately and output the DLL to the same specified directory. All projects reference the DLL under the modified directory.

If you open more than two vs. Net projects at the same time, the system may report an error during compilation, saying that the specified DLL is in use.

In this way, you need to do the following:
A. specify the output directory. Right-click the project icon and choose "generate" and "output" from "configuration properties" to set the output path, delete the wrong DLL Reference Path in "Reference Path" in "general attributes.
B. Do not copy the referenced DLL to the local directory. Set "Copy local" in the property to false when selecting all project reference DLL files. If this parameter is not set, the "variable already defined in multiple places" error may occur. Mainly, for the UI Layer Project (that is, the project that can be run), you must copy all the DLL referenced by the change project to its bin directory, because the "project that can be run" will only look for DLL under the bin directory at runtime, if not, the runtime error of DLL cannot be found will be reported!
The advantage of this method is that each project team only needs to compile their own DLL and submit it to the configuration administrator. The configuration administrator can compile the entire solution in a unified manner, which is faster. The disadvantage is that if a project group only updatesSource codeFile, not the latest DLL referenced in the solution.

The above two methods can solve the reference conflict between 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.