MS Build files can contain conditionals. By setting those conditions only on container nodes on level 1 (such as <PropertyGroup> and <ItemGroup>), readability is improved. As a bonus, conditional configuration is automatically grouped. Note that Choose/When is ignored by this rule.
<Project>
<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<GeneratePackageOnBuild Condition="'$(Configuration)'=='Release'">true</GeneratePackageOnBuild>
</PropertyGroup>
</Project>
<Project>
<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)'=='Release'">
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
</PropertyGroup>
</Project>