Search code examples
dvisual-studio-2013dependency-management

How to make one project depend on another in Visual Studio?


Is it possible to have one project depend on another project within the same solution? Say I have project A, which statically links to project B, how would I set this up? Ideally I would like to not mention project B's path from within project A, but rather have them output their files maybe in the same folder up in the directory tree. (Maybe using the solution path)

Would outputing program A & B both in the same directory just let it work? I've set A to depend on B already (so B always builds when A does), but it is a static library, so I'd expect it to have to somehow be mixed up with the object file and not the executable?


EDIT: I have both output directories set to the same directory, but it is not linking.


Solution

  • The proper way to do this is to configure the solution dependencies appropriately. In the solution explorer, right click solution -> Project dependencies... -> configure appropriately. Assuming you configure that correctly, you don't need to mention any paths or libraries in the linker, the dependant libs will link automatically.

    Under VisualD, this works for C/C++ and D projects. I have D projects which depend on C libraries working fine.