C
C#2y ago
Ruttie

❔ CSProj DefineConstants

I have the following in my csproj:
<PropertyGroup>
...
<Configurations>Debug;Release;WIN-STEAM;MAC-STEAM;LIN-STEAM;WIN-GOG;MAC-GOG;LIN-GOG</Configurations>
</PropertyGroup>
<PropertyGroup>
<DefineConstants Condition="'$(Configuration)' == 'WIN-STEAM'">$(DefineConstants);WINDOWS;STEAM</DefineConstants>
<DefineConstants Condition="'$(Configuration)' == 'MAC-STEAM'">$(DefineConstants);MACOS;STEAM</DefineConstants>
<DefineConstants Condition="'$(Configuration)' == 'LIN-STEAM'">$(DefineConstants);LINUX;STEAM</DefineConstants>
<DefineConstants Condition="'$(Configuration)' == 'WIN-GOG'">$(DefineConstants);WINDOWS;GOG</DefineConstants>
<DefineConstants Condition="'$(Configuration)' == 'MAC-GOG'">$(DefineConstants);MACOS;GOG</DefineConstants>
<DefineConstants Condition="'$(Configuration)' == 'LIN-GOG'">$(DefineConstants);LINUX;GOG</DefineConstants>
<DefineConstants Condition="'$(Configuration)' == 'Debug'">$(DefineConstants);WINDOWS;STEAM</DefineConstants>
</PropertyGroup>
<PropertyGroup>
...
<Configurations>Debug;Release;WIN-STEAM;MAC-STEAM;LIN-STEAM;WIN-GOG;MAC-GOG;LIN-GOG</Configurations>
</PropertyGroup>
<PropertyGroup>
<DefineConstants Condition="'$(Configuration)' == 'WIN-STEAM'">$(DefineConstants);WINDOWS;STEAM</DefineConstants>
<DefineConstants Condition="'$(Configuration)' == 'MAC-STEAM'">$(DefineConstants);MACOS;STEAM</DefineConstants>
<DefineConstants Condition="'$(Configuration)' == 'LIN-STEAM'">$(DefineConstants);LINUX;STEAM</DefineConstants>
<DefineConstants Condition="'$(Configuration)' == 'WIN-GOG'">$(DefineConstants);WINDOWS;GOG</DefineConstants>
<DefineConstants Condition="'$(Configuration)' == 'MAC-GOG'">$(DefineConstants);MACOS;GOG</DefineConstants>
<DefineConstants Condition="'$(Configuration)' == 'LIN-GOG'">$(DefineConstants);LINUX;GOG</DefineConstants>
<DefineConstants Condition="'$(Configuration)' == 'Debug'">$(DefineConstants);WINDOWS;STEAM</DefineConstants>
</PropertyGroup>
However, when I add the following code:
#if MACOS && STEAM
Console.WriteLine("Mac");
#endif
#if MACOS && STEAM
Console.WriteLine("Mac");
#endif
And set the configuration to MAC-STEAM (vs), the code does not get compiled into the project. Any idea what I'm doing wrong?
1 Reply
Accord
Accord2y ago
Looks like nothing has happened here. I will mark this as stale and this post will be archived until there is new activity.
Want results from more Discord servers?
Add your server