Can I add conditional defines in the msbuild command line?

Disclaimer: don't use MsBuild myself yet, all taken from the docs and some IDE experimentation.

Disclaimer: don't use MsBuild myself yet, all taken from the docs and some IDE experimentation According to MsBuild command line reference ( msdn.microsoft.com/en-us/library/ms16431... ): /property:name=value Sets or overrides these project-level properties, where name is the property name and value is the property value. Use a semicolon or a comma to separate multiple properties, or specify each property separately. /p is also acceptable.

For example: /property:WarningLevel=2;OutputDir=bin\Debug setting or overriding is all you can do for a property value. Adding to a property value from the project file is either not possible or a case of a hidden feature. But I guess what you could do is define a custom property in your dproj file with an " " as its default value: reference that in your defines statement DUNIT;$(ExtraDefines);$(DCC_Define) which in the IDE should be DUNIT;$(ExtraDefines) and then specify it on the command line: msbuild boohoo.

Dproj /p:Config=Release;ExtraDefines="hoo" I did test adding the $(ExtraDefines) to the Include options for the project using the IDE. And at least that didn't barf at me, even without having the option defined in the dproj. The commandline the IDE produced from this was: ...rad studio\7.0\bin\dcc32.

Exe --no-config -B -Q -DDEBUG;DUNIT; -E.... Which seems to indicate that the $(ExtraDefines) got eliminated as it had no value. And that it should be picked up using MSBuild and specififying a value on the command line.

Thanks. Good thinking. I'll try this out as soon as I get to a machine.

– David Heffernan Dec 14 at 18:04 2 Wonderful. That works beautifully. Really excellent thinking, thank you ever so much.

– David Heffernan Dec 14 at 19:50 1 Glad I could help :) – Marjan Venema Dec 14 at 20:06.

Straightforward solution is to create a new build configuration (say, boohooRelease), add both boo and hoo conditional defines to it and compile as msbuild boohoo. Dproj /p:Config=boohooRelease. Not exactly what you are trying to do, but it works.

Yes this would work but I'm looking for something lighter weight that decouples the dproj file from the build for when I want to build experimental versions of the code containing conditional code – David Heffernan Dec 14 at 18:05.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions