<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net5.0</TargetFramework>
<!-- Define a default value for EnableMyFeature, can be overridden by referencing project -->
<EnableMyFeature>false</EnableMyFeature>
</PropertyGroup>
<PropertyGroup Condition="'$(EnableMyFeature)' == 'true'">
<DefineConstants>$(DefineConstants);MY_CONSTANT</DefineConstants>
</PropertyGroup>
<!-- ... -->
</Project>
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net5.0</TargetFramework>
<!-- Define a default value for EnableMyFeature, can be overridden by referencing project -->
<EnableMyFeature>false</EnableMyFeature>
</PropertyGroup>
<PropertyGroup Condition="'$(EnableMyFeature)' == 'true'">
<DefineConstants>$(DefineConstants);MY_CONSTANT</DefineConstants>
</PropertyGroup>
<!-- ... -->
</Project>