.NET project file analyzers community

Proj0241: Enable package baseline validation

To ensure the backwards compatibility of the API surface of your package, it is adviced to enable package baseline validation by defining the <PackageValidationBaselineVersion> node with the version of the previous stable release.

More information can be found here.

Non-compliant

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

  <PropertyGroup>
    <TargetFramework>net8.0</TargetFramework>
    <Version>2.0.0</Version>
    <EnablePackageValidation>true</EnablePackageValidation>
  </PropertyGroup>

</Project>

Compliant

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

  <PropertyGroup>
    <TargetFramework>net8.0</TargetFramework>
    <Version>2.0.0</Version>
    <EnablePackageValidation>true</EnablePackageValidation>
    <PackageValidationBaselineVersion>1.0.0</PackageValidationBaselineVersion>
  </PropertyGroup>

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

  <PropertyGroup>
    <TargetFramework>net8.0</TargetFramework>
    <Version>2.0.0</Version>
    <EnablePackageValidation>false</EnablePackageValidation>
  </PropertyGroup>

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

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

</Project>