Skip to content

Latest commit

 

History

History
49 lines (37 loc) · 1.35 KB

File metadata and controls

49 lines (37 loc) · 1.35 KB
parent ancestor
Packaging
Rules

Proj0251: Enable API compatibility attribute checks

When package validation is enabled, it is advised to opt-in to the strict attribute compatibility checks.

More information can be found here and here.

Non-compliant

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

  <PropertyGroup>
    <TargetFramework>net8.0</TargetFramework>
    <EnablePackageValidation>true</EnablePackageValidation>
    <ApiCompatEnableRuleAttributesMustMatch>false</ApiCompatEnableRuleAttributesMustMatch>
  </PropertyGroup>

</Project>

Or:

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

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

</Project>

Compliant

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

  <PropertyGroup>
    <TargetFramework>net8.0</TargetFramework>
    <EnablePackageValidation>true</EnablePackageValidation>
    <ApiCompatEnableRuleAttributesMustMatch>true</ApiCompatEnableRuleAttributesMustMatch>
  </PropertyGroup>

</Project>