.NET project file analyzers community

Proj1002: Use Microsoft’s analyzers

Microsoft has implemented multiple generic Roslyn static code analysis rules both for C# and Visual Basic. These rules allow you to produce safe, reliable and maintainable code by helping you find and correct bugs, vulnerabilities and code smells in your codebase. It is strongly advised to enable these rules on all your projects.

For .NET 5 and later, is enabled by default. However, it is considered a good practice to explicitly enable it for later frameworks as well.

See: learn.microsoft.com/dotnet/fundamentals/code-analysis/overview

Compliant

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

  <PropertyGroup>
    <TargetFramework>net8.0</TargetFramework>
    <EnableNETAnalyzers>true</EnableNETAnalyzers>
  </PropertyGroup>

</Project>