Proj0050: Enforce code-style in builds

Code-style analysis (“IDExxxx”) rules enable you to define and maintain consistent code style in your codebase. During a build, these rules are disabled by default. This rule advises to explicitly enable (or disable) code-style analysis during build by setting the <EnforceCodeStyleInBuild>. It is up to teams to decide which of these rules should be enabled, and with which severity level.

Non-compliant

<Project Sdk="Microsoft.NET.Sdk">

  <PropertyGroup>
    <TargetFramework>net10.0</TargetFramework>
  </PropertyGroup>

</Project>

Compliant

<Project Sdk="Microsoft.NET.Sdk">

  <PropertyGroup>
    <TargetFramework>net10.0</TargetFramework>
    <EnforceCodeStyleInBuild>true</EnforceCodeStyleInBuild>
  </PropertyGroup>

</Project>

or, explicitly disabled.

<Project Sdk="Microsoft.NET.Sdk">

  <PropertyGroup>
    <TargetFramework>net10.0</TargetFramework>
    <EnforceCodeStyleInBuild>false</EnforceCodeStyleInBuild>
  </PropertyGroup>

</Project>