I am using preprocessor conditions in my source code to emit different code based on the RuntimeIdentifier. Though, the code is always grayed out since I can't choose a context that is based on both TargetFramework and RuntimeIdentifier.
In the Visual Studio navigation bar I can switch between net461 and netstandard2.0. How can I switch between both TargetFramework AND RuntimeIdentifier to make my code active?
Here is the code snippet I want to make active (not grayed out):
I'm using Visual Studio 2017 version 15.9.23.
Here is a snippet of my csproj:
<PropertyGroup>
<TargetFrameworks>net461;netstandard2.0</TargetFrameworks>
<RuntimeIdentifiers>win-x64;linux-x64</RuntimeIdentifiers>
</PropertyGroup>
<PropertyGroup Condition=" '$(TargetFramework)' == 'netstandard2.0'">
<DefineConstants>NETCORE;NETSTANDARD;NETSTANDARD2_0</DefineConstants>
</PropertyGroup>
<PropertyGroup Condition=" '$(TargetFramework)' == 'net461'">
<DefineConstants>NET461;NETFULL</DefineConstants>
</PropertyGroup>
<PropertyGroup>
<DefineConstants Condition="'$(RuntimeIdentifier)' == 'win-x64'">$(DefineConstants);WINDOWS</DefineConstants>
</PropertyGroup>
<PropertyGroup>
<DefineConstants Condition="'$(RuntimeIdentifier)' == 'linux-x64'">$(DefineConstants);LINUX</DefineConstants>
</PropertyGroup>