.netmsbuildcompiler-options

Defining conditional compilation symbols in MSBuild


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 build script:

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 PropertiesBuildConditional compilation symbols, but I have not seen that option for MSBuild.

Can I completely override all symbols already specified in the .csproj files to make sure that only the conditionals from my build script go in?


Solution

  • Have you seen this (archived copy)? Most info is in the penultimate post:

    /p:DefineConstants="MYSYMBOL1;MYSYMBOL2"