visual studio macro with the path of a props file
c++, msbuild, visual-studio-2010
Solution
I would suggest that you have conflicting interests:
- Provide a props file that all developers use, and eliminate the need for developers to qualify `#include` paths
- Allow all developers to specify the root location of those `#include` paths.
This isn't the answer you were looking for, but I would suggest you take a different approach.
Two come to mind:
Let each developer define build-time macros in the `Microsoft.Cpp.x64.user` file, such as `$(MY_PROJECT_ROOT)`, and in the checked-in props file, specify directories relative to those macros.
Use an absolute path in the checked-in props file, but make that absolute path a junction point, such as `X:\`. Each developer would define where `X:\` points to.
Number 2 has an advantage of making it a little easier to switch between trunks. Perhaps say release 1.0 of you application an Beta 2.0 of your application. You can use the same props file in both; the developer would just run a batch file to switch junctions when moving from one trunk to another.
However Number 1 has the advantage of being a solution completely enclosed within the IDE.
Problem
The short question: I want to be able to use the path of the props file as a macro from inside the props file (like the ability to reference the project directory as `$(ProjectDir)` ) The long question I use props files to add reference to various 3rd party libraries. This is simple if I can specify an absolute path to the 3rd party library. However, I want to specify a relative path - as different team members use different location for the source control tree. is there a method to add such relative paths to the props file? specifying a path relative to the project directory isn't a good solution either, as the location of projects isn't fixed (so for one project I would need `$(SolutionDir)\..\XXXX` and for another one I would need `$(SolutionDir)\..\..\XXXX`