C#C
C#3y 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>

However, when I add the following code:
#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?
Was this page helpful?