dotnet-project-file-analyzers

Proj0009: Use the <TargetFramework> node for a single target framework

To prevent confusion, only use the <TargetFrameworks> node when there are multiple target frameworks. Otherwise use the <TargetFramework> node.

Non-complaint

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

  <PropertyGroup>
    <TargetFrameworks>net8.0</TargetFrameworks>
  </PropertyGroup>

</Project>

Compliant

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

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

</Project>