title: Passing define constants to dotnet build kills target framework symbols
body: <p>I created a small application which targets two frameworks (.net core 2.2 and .net core 3.0) and uses target framework symbols (NETCOREAPP2_2 and NETCOREAPP3_0).</p>
  
  <p>The project file is very simple and looks so:</p>
  
  <pre><code>&lt;Project Sdk="Microsoft.NET.Sdk"&gt;
    &lt;PropertyGroup&gt;
      &lt;TargetFrameworks&gt;netcoreapp3.0;netcoreapp2.2&lt;/TargetFrameworks&gt;
      &lt;OutputType&gt;Exe&lt;/OutputType&gt;
    &lt;/PropertyGroup&gt;
  &lt;/Project&gt;
  </code></pre>
  
  <p>The program code might not be simpler:</p>
  
  <pre><code>public class MyClass
  {
      static void Main()
      {
  #if NETCOREAPP3_0
          System.Console.WriteLine("Target framework: NETCOREAPP3_0");
  #elif NETCOREAPP2_2  
          System.Console.WriteLine("Target framework: NETCOREAPP2_2");
  #else
          System.Console.WriteLine("Target framework: WHO KNOWS?!");
  #endif
  
  #if TEST_RUN
          System.Console.WriteLine("Test mode active!");
  #endif
      }
  }
  </code></pre>
  
  <p>If I build it using regular <code>dotnet build --no-incremental</code> command without additional parameters, both version created and work as expected:</p>
  
  <pre><code>PS&gt;&gt; dotnet .\bin\Debug\netcoreapp2.2\TargetFramework.dll
  Target framework: NETCOREAPP2_2
  PS&gt;&gt; dotnet .\bin\Debug\netcoreapp3.0\TargetFramework.dll
  Target framework: NETCOREAPP3_0
  </code></pre>
  
  <p>In my scenario I need to build both versions with additional compilation symbol <code>TEST_RUN</code>. So I added additional parameter to my build command <code>dotnet build --no-incremental -p:DefineConstants=TEST_RUN</code>. As a result I have an app without any idea of a target framework:</p>
  
  <pre><code>PS&gt;&gt; dotnet .\bin\Debug\netcoreapp2.2\TargetFramework.dll
  Target framework: WHO KNOWS?!
  Test mode active!
  PS&gt;&gt; dotnet .\bin\Debug\netcoreapp3.0\TargetFramework.dll
  Target framework: WHO KNOWS?!
  Test mode active!
  </code></pre>
  
  <p>I need to keep preprocessor symbols for target framework, but I have no idea how to do it. Any ideas? </p>