Framework and references vs project dependencies

来源:互联网 发布:usb3.0传输数据速度 编辑:程序博客网 时间:2024/06/05 00:54

Function "framework and references" can reference assembly generated by another project in same or separate solution, or contained in another team project and third-part assembly.

 

Function "project dependencies" . makes it possible for you to determine which projects in the selected solution must be built first. Setting project dependencies stipulates the desired build order for projects. 


Project dependency isn't a property of the linker, but rather the build chain as a whole.  Say project A is a stand alone binary that compresses a file.  Project B executes this binary.  Project B wants to make sure it has the most up to date binary of Project A available, so the developer says B is dependent on A.  Say the developer is working on Project B fixing a bug in some file, and this file happens to be shared with Project A.  Now when the developer builds their Project B, they will also rebuild Project A, getting the updated (corrected) version of Project A.  In this manner, a dependency exists, but it is not a linker based dependency.


As described here (see "Solution Dependencies into Project to project reference section") , the intent was to take linker level dependency out of the solution and push it into the project.


So If project A need use project B, in project A, we need (1) #pragma comment(lib,"B.lib") or in project properties--->linker--->input--->additional dependencies--->add "B.lib" (2) properties--->Framework and references--->Add new reference---->select project B, then in project dependencies, B is checked for A, and the build order is also sorted automatically (B build before A). (3) If A need include some new header files, you need add new include directory in A properties--->C/C++--->Additional include directories if necessary.