SQ Tech Code Quality Standards

C# Setup

  • Install the package in each project or in a Directory.Build.props file:

    <PackageReference Include="Microsoft.XboxStudios.CodeQuality" Version="0.6.1" />

  • If the code should conform to StyleCop checks, also add:

    <PackageReference Include="Microsoft.XboxStudios.CodeQuality.Style" Version="0.6.1" />
    <PackageReference Include="StyleCop.Analyzers" Version="1.2.0-beta.406" />
    
  • If the code shouldn't require StyleCop documentation or use of ConfigureAwait(false), then add this alternate package instead of the default one:

    <PackageReference Include="Microsoft.XboxStudios.CodeQuality.Applications" Version="0.6.1" />

  • If the code is a Nuke build, then add this alternate package instead of the default style:

    <PackageReference Include="Microsoft.XboxStudios.CodeQuality.Style.Nuke" Version="0.6.1" />

C# Libraries

  • After installing the package in each project or in a Directory.Build.props file, find the corresponding PackageReference setting and set PrivateAssets="All" to prevent it being added as a transitive dependency of your library's NuGet package:

    <PackageReference Include="Microsoft.XboxStudios.CodeQuality" Version="0.6.1" PrivateAssets="All" />
    <PackageReference Include="Microsoft.XboxStudios.CodeQuality.Style" Version="0.6.1" PrivateAssets="All" />
    <PackageReference Include="StyleCop.Analyzers" Version="1.2.0-beta.406" PrivateAssets="All" />
    

Central Versions

  • If you don't want to add these packages in each project or in a Directory.Build.props file, we recommend the Central Versions NuGet SDK which lets you automatically install them like so in Packages.props:

    <GlobalPackageReference Include="Microsoft.XboxStudios.CodeQuality" Version="0.6.1" />
    <GlobalPackageReference Include="Microsoft.XboxStudios.CodeQuality.Style" Version="0.6.1" />
    <GlobalPackageReference Include="StyleCop.Analyzers" Version="1.2.0-beta.406" />
    

.NET 5+ support

  • Starting in Visual Studio 2019 16.8 and .NET 5.0, the FxCopAnalyzers package is deprecated and replaced by built-in NET Analyzers. These are enabled by default when targeting net5.0, and we opt-in other projects automatically using <EnableNETAnalyzers>true</EnableNETAnalyzers>.

This page was last modified on June 12 2023, 06:45 PM (UTC).

  • Edit this page
In this article
Back to top Generated by DocFX