title: Compile time constants wont work in mac os x in .net core
body: <p>So i'm currently trying to use compile time constants in my csproj using .net standard 2.0 with inspiration from here : <a href="https://github.com/Microsoft/msbuild/issues/539" rel="nofollow noreferrer">https://github.com/Microsoft/msbuild/issues/539</a></p>
  
  <p>As you can see in the documentation $(OS) returns Unix for both Mac and Linux and I have some specific logic just for the Mac OS X. The $OS works fine. One solution would of course just be to do this on the runtime instead. </p>
  
  <pre><code>  &lt;PropertyGroup&gt;
      &lt;TargetFramework&gt;netstandard2.0&lt;/TargetFramework&gt;
  
      &lt;IsOSX Condition="'$([System.Runtime.InteropServices.RuntimeInformation]::IsOSPlatform($([System.Runtime.InteropServices.OSPlatform]::OSX)))' == 'true'"&gt;true&lt;/IsOSX&gt;
      &lt;IsLinux Condition="'$([System.Runtime.InteropServices.RuntimeInformation]::IsOSPlatform($([System.Runtime.InteropServices.OSPlatform]::Linux)))' == 'true'"&gt;true&lt;/IsLinux&gt;
    &lt;/PropertyGroup&gt;
  
  
    &lt;Target Name="PrintRID" BeforeTargets="Build"&gt;
      &lt;Message Text="IsWindows $(IsWindows)" Importance="high" /&gt;
      &lt;Message Text="IsOSX $(IsOSX)" Importance="high" /&gt;
      &lt;Message Text="IsLinux $(IsLinux)" Importance="high" /&gt;
    &lt;/Target&gt;
  </code></pre>
  
  <p>And this executes the correct output on build : Target PrintRID:
      IsWindows 
      IsOSX true
      IsLinux </p>
  
  <p>But when i then try to use it as an constant it will not work. </p>
  
  <pre><code>  &lt;PropertyGroup Condition="$(IsOSX)"&gt;
      &lt;DefineConstants&gt;MACOSX&lt;/DefineConstants&gt;
    &lt;/PropertyGroup&gt;
  </code></pre>
  
  <p>Usage : </p>
  
  <pre><code>#if MACOSX
              return "OSX"; 
  #elif WINDOWS
              return "Windows"; 
  #elif LINUX
              return "Linux"; 
  #endif
  </code></pre>
  
  <p>anyone have any good idea what i'm doing wrong? 
  The <code>System.Runtime.InteropServices.RuntimeInformation.IsOSPlatform(System.Runtime.InteropServices.OSPlatform.OSX)</code>
  Also returns true. </p>
  
  <p>Dotnet version is 2.1.4, with visual studio for mac at version 7.4.2, osx version 10.13.2</p>
  
  <p>Just to be sure, here is my full csproj file : </p>
  
  <pre><code>&lt;Project Sdk="Microsoft.NET.Sdk"&gt;
  
    &lt;PropertyGroup&gt;
      &lt;TargetFramework&gt;netstandard2.0&lt;/TargetFramework&gt;
      &lt;PackageId&gt;Nyranith.Internal&lt;/PackageId&gt;
      &lt;PackageVersion&gt;$(VersionSuffix)&lt;/PackageVersion&gt;
      &lt;Authors&gt;Nyranith&lt;/Authors&gt;
      &lt;Description&gt;&lt;/Description&gt;
      &lt;PackageRequireLicenseAcceptance&gt;false&lt;/PackageRequireLicenseAcceptance&gt;
      &lt;Copyright&gt;&lt;/Copyright&gt;
      &lt;PackageTags&gt;&lt;/PackageTags&gt;
    &lt;/PropertyGroup&gt;
  
    &lt;PropertyGroup&gt;
      &lt;TargetFramework&gt;netstandard2.0&lt;/TargetFramework&gt;
  
      &lt;IsOSX Condition="'$([System.Runtime.InteropServices.RuntimeInformation]::IsOSPlatform($([System.Runtime.InteropServices.OSPlatform]::OSX)))' == 'true'"&gt;true&lt;/IsOSX&gt;
      &lt;IsLinux Condition="'$([System.Runtime.InteropServices.RuntimeInformation]::IsOSPlatform($([System.Runtime.InteropServices.OSPlatform]::Linux)))' == 'true'"&gt;true&lt;/IsLinux&gt;
    &lt;/PropertyGroup&gt;
  
  
    &lt;Target Name="PrintRID" BeforeTargets="Build"&gt;
      &lt;Message Text="IsWindows $(IsWindows)" Importance="high" /&gt;
      &lt;Message Text="IsOSX $(IsOSX)" Importance="high" /&gt;
      &lt;Message Text="IsLinux $(IsLinux)" Importance="high" /&gt;
    &lt;/Target&gt;
  
    &lt;PropertyGroup Condition="$(IsOSX)"&gt;
      &lt;DefineConstants&gt;MACOSX&lt;/DefineConstants&gt;
    &lt;/PropertyGroup&gt;
  
    &lt;PropertyGroup Condition="'$(OS)' == 'Unix'"&gt;
      &lt;DefineConstants&gt;UNIX&lt;/DefineConstants&gt;
    &lt;/PropertyGroup&gt;
  
     &lt;PropertyGroup Condition="'$(OS)' == 'Windows_NT' "&gt;
      &lt;DefineConstants&gt;WINDOWS_NT&lt;/DefineConstants&gt;
    &lt;/PropertyGroup&gt;
  
     &lt;ItemGroup&gt;
       &lt;Folder Include="NewFolder\" /&gt;
     &lt;/ItemGroup&gt;
  
  &lt;/Project&gt;
  </code></pre>