Conditional compilation issue

I have two projects A and B. A depends on B. I would like the following to happen:

If B defines a conditional compilation character, I would like A to also detect it automatically. Can i achieve this?

+4
source share
2 answers

No, basically. Compilation symbols are used for each project in the project settings and for each file depending on the #define pragmas. There is no way to make the project you are compiling to determine your compilation symbols - they disappear after compilation, efficiently.

The easiest way would be to create suitable solution configurations and project configurations within them that define the corresponding characters.

+6
source

If you have many project files,

  • Use custom MSBuild script
  • Or write a “project file generator” that will create all your project files for you (they are just XML anyway)

(It’s unfortunate that you cannot trace more than one project file and then “edit multiple times”)

+1
source

Source: https://habr.com/ru/post/1336751/


All Articles