0

I am working in a solution where there is a specific library in the solution that turns on or off functionality via #ifdef's.

I have another project in the solution that uses it as a dependency. In my build settings, I want to be able to define the symbols in the dependent library based on build configuration in my project. I cannot find any way to do this within Visual Studio.

Is there any way to accomplish this?

(I realize the ideal solution here would be to change those #ifdef's to something else, but please assume that I cannot edit code in the other project)

Chuu
  • 4,301
  • 2
  • 28
  • 54

2 Answers2

2

Build tab in project options depends on selected value of build configuration dropdown. You can test, when you've selected Debug, Define DEBUG constant is checked, but not in Release mode.

Just choose appropriate configuration (Debug, Release or custom one) and set value of conditional compilation symbols.

archil
  • 39,013
  • 7
  • 65
  • 82
1

I don't think you can do that. There are no "solution level" defines, all defines are scoped to a project.

As @archil points out you may be able to achieve some by selecting correct configuration for the project.

One more option could be to build project with MSBuild directly instead of using normal VS IDE route, this way you will be able to override defines via command line (http://stackoverflow.com/questions/479979/msbuild-defining-conditional-compilation-symbols)

Alexei Levenkov
  • 98,904
  • 14
  • 127
  • 179