tags:

views:

2569

answers:

3

I'm possibly just blind, but is there a command line to specify conditional compilation symbols in MSBUILD?

I currently have this Line in my buildscript:

SET MSBUILD=C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\MSBuild.exe
SET CONFIG=Debug
%MSBUILD% /p:Configuration=%CONFIG% /p:OutputPath=..\..\output source\MyProject\MyProject.csproj

And I'd like to add a condition. In Visual Studio, i can just go into Project Properties => Build => Conditional compilation symbols, but I have not seen that option for msbuild?

Bonus Karma if you know if I can completely override all symbols already specified in the .csproj files to make sure that only the conditionals from my Buildscript go in.

Thanks!

+9  A: 

Have you seen this? (most info is in the penultimate post)

/p:DefineConstants="MYSYMBOL1;MYSYMBOL2"
Tomalak
Added the Code, that was it, thanks! It overrides all Constants that may be defined in the .csproj file, which is good as well.
Michael Stum
I can already feel the bonus karma. ;-)
Tomalak
+1  A: 

I had to use a space instead of a semicolon a la http://www.linqinpark.net/2009/01/13/MSBuildWithMultipleDefineConstants.aspx

Ruben Bartelink
A: 

Does anyone know how to specify a constant towards only a particular project w/in the solution?

And to apply another constant towards a different particular project w/in the solution?

Eric