Как задать define в билд-скрипте

Разработка на C# под linux
 
Параметр компилятору:
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

<ClCompile>
	....
	<PreprocessorDefinitions>$(MyMacro);%(PreprocessorDefinitions)</PreprocessorDefinitions>
</ClCompile>
Это то же самое, что написать:

  <Target Name="TestBuild" Returns="@(ManagedTargetPath)">
    <MSBuild Projects="demo.vcxproj" Targets="NormalBuild" Properties="MyMacro=THISGETSSETBUTDOESNOTHING"/>
  </Target>
или

<MSBuild Projects="demo.vcxproj" 
         Properties="ForceImportBeforeCppTargets=override.props"/>

PropertyGroup Label=Globals


put <DefineConstants>< /DefineConstants>

under the <PropertyGroup Label=Globals >

<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="3.5" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
  <PropertyGroup>
    <!-- Default value here -->
    <DefineConstants Condition=" '$(DefineConstants)'==''" >DEBUG;TRACE</DefineConstants>
  </PropertyGroup>
  ...

/t:Rebuild

msbuild will not rebuild if only the directive changed, so you may also want to add /t:Rebuild