title: Conditional per TargetFramework in MsBuild 15
body: <p>With the new MsBuild version it's really easy to target multiple frameworks and framework versions in .csproj project:</p>
  
  <pre><code>&lt;TargetFrameworks&gt;net40;net45;net461;netcoreapp1.1&lt;/TargetFrameworks&gt;
  </code></pre>
  
  <p>Now, how do I get a constant defined for each of them so that I can have certain code only be part of e.g. <code>netcoreapp1.1</code> pass and not full framework compilation?</p>
  
  <p>I'd like to be able to add a preprocessor directive like this one:</p>
  
  <pre><code>#if NET_CORE
      // some code
  #endif
  </code></pre>
  
  <p>And the same for full .NET Framework and possibly .NET Standard.</p>
  
  <p>The other questions I found don't take new <code>&lt;TargetFrameworks&gt;</code> way of defining the framework into accounts. Stuff like this doesn't work:</p>
  
  <pre><code>&lt;DefineConstants Condition=" '$(TargetFramework)' == '.NETCoreApp' "&gt;NET_CORE&lt;/DefineConstants&gt;
  </code></pre>