Параметр компилятору:
https://msdn.microsoft.com/en-us/library/0feaad6z(VS.80).aspx
Параметр для msbuild:
http://stackoverflow.com/a/480207/1709408
/p:DefineConstants="MYSYMBOL1;MYSYMBOL2"
It overrides all Constants that may be defined in the .csproj file
https://social.msdn.microsoft.com/Forums/vstudio/en-US/95bf6b1d-9dae-48ba-b56d-08fa5ae26563/override-conditional-compilation-symbols?forum=tfsbuild
the point is that if you want to support multiple defines to a project by commandline you'll have to separate them by simple spaces...
"/p:DefineConstants=MY_PREPROC_FLAG YET_ANOTHER_FLAG"
and it will be added to the (semicolon-separated) Defines from the IDE.
http://stackoverflow.com/questions/2016697/msbuild-exe-not-accepting-either-pdefineconstants-nor-ppreprocessordefinitio
http://stackoverflow.com/questions/15141429/how-to-set-preprocessordefinitions-as-a-task-propery-for-the-msbuild-task
PreprocessorDefinitions
(is taken from a regular VS2010 C++ project)
which is not a PropertyGroup, and thus can't be passed via the MSBuild command line.
MSBuild demo.vcxproj /p:MyMacro=THISGETSSETBUTDOESNOTHING
....
$(MyMacro);%(PreprocessorDefinitions)
Это то же самое, что написать:
или
PropertyGroup Label=Globals
put < /DefineConstants>
under the
DEBUG;TRACE
...
/t:Rebuild
msbuild will not rebuild if only the directive changed, so you may also want to add /t:Rebuild