title: command line msbuild with multiple DefineConstants
body: <p>From powershell</p>
  
  <pre><code>Set-Alias msbuild C:\WINDOWS\Microsoft.NET\Framework64\v4.0.30319\MSBuild.exe
  </code></pre>
  
  <p>and running from the same directory as my sln file</p>
  
  <pre><code>&gt; msbuild /nologo /property:DefineConstants=FOO
  </code></pre>
  
  <p>works just fine. Let's say I need two build time constants though.</p>
  
  <pre><code>&gt; msbuild /nologo /property:DefineConstants=FOO;BAR
  </code></pre>
  
  <p>Powershell interprets the semi-colon as an end-of-statement and runs with a single constant and then tries to run the command <code>BAR</code> and errors. So not what I want.</p>
  
  <p>How about?</p>
  
  <pre><code>&gt; msbuild /nologo /property:DefineConstants="FOO;BAR"
  MSBUILD : error MSB1006: Property is not valid.
  Switch: BAR
  </code></pre>
  
  <p>This doesn't work either. Not sure what's going on here but it seems to be interpreting "FOO;BAR" as some sort of single thing - not two constants.</p>
  
  <p>So. How do I actually pass in multiple constants?</p>
  
  <p><strong>Edit</strong>
  Upon further investigation, I'm running the following in cmd.exe</p>
  
  <pre><code>&gt;C:\WINDOWS\Microsoft.NET\Framework64\v4.0.30319\MSBuild.exe /nologo /property:DefineConstants=FOO;BAR
  MSBUILD : error MSB1006: Property is not valid.
  Switch: BAR
  </code></pre>
  
  <p>although this works</p>
  
  <pre><code>&gt;C:\WINDOWS\Microsoft.NET\Framework64\v4.0.30319\MSBuild.exe /nologo /property:DefineConstants="FOO;BAR"
  </code></pre>