title: Define C# preprocessor from MsBuild
body: <p>In my <code>C#</code> file I want to have a preprocessor condition like this:</p>
  
  <pre><code>#if DEMO
      ShowSplash();
  #endif
  </code></pre>
  
  <p>I'm running this command from command line:</p>
  
  <pre><code>MSBuild MySolution.sln /p:Configuration=Release /p:Platform="Any CPU" /p:DEMO=1
  </code></pre>
  
  <p>Then, in <code>MyProject.csproj</code> file I have the following:</p>
  
  <pre><code>&lt;PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "&gt;
      &lt;DefineConstants&gt;TRACE;DEMO=$(DEMO)&lt;/DefineConstants&gt;
  &lt;/PropertyGroup&gt;
  </code></pre>
  
  <p>But the preprocessor seems to skip my splash code. (I'm aware of the difference between "Any CPU" and "AnyCPU". I never touched that, so I'm quite sure Visual Studio doesn't care about the space.)</p>
  
  <p><code>DEMO</code> is not defined? The same construct seems to work in other project types (e.g. <code>.wixproj</code>) <strong>What am I missing here?</strong></p>