.NET project file analyzers community

Proj0453: Using Microsoft.NET.Test.Sdk implies a test project

The inclusion of Microsoft.NET.Test.Sdk implies that the project is a test project. Although there might be exceptions to this rule, in most cases including the SDK is done to run unit tests with the dotnet test command.

Non-compliant

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

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

  <ItemGroup Label="Build tools">
    <PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.11.0" PrivateAssets="all" />
  </ItemGroup>
  
</Project>

Compliant

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

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

  <ItemGroup Label="Build tools">
    <PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.11.0" PrivateAssets="all" />
  </ItemGroup>
  
</Project>