.NET project file analyzers community

Proj0452: Test projects require Microsoft.NET.Test.Sdk

Tests in a test projects do not run without the Microsoft.NET.Test.Sdk being included. So in order to get test results with the dotnet test command, the SDK has to be included.

Non-compliant

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

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

</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>