Skip to content

Latest commit

 

History

History
58 lines (43 loc) · 1.25 KB

File metadata and controls

58 lines (43 loc) · 1.25 KB

Proj0211: Avoid using deprecated license definition

The <PackageLicenseUrl> node has been deprecated and should be replaced by either the <PackageLicenseExpression> or the <PackageLicenseFile> node when referring to the license of a NuGet package.

Non-compliant

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

  <PropertyGroup>
    <TargetFramework>net8.0</TargetFramework>
    <PackageLicenseUrl>https://github.com/Corniel/dotnet-project-file-analyzers/blob/main/LICENSE.md</PackageLicenseUrl>
  </PropertyGroup>

</Project>

Compliant

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

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

</Project>

Or:

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

  <PropertyGroup>
    <TargetFramework>net8.0</TargetFramework>
    <PackageLicenseFile>LICENSE.md</PackageLicenseFile>
  </PropertyGroup>

  <ItemGroup>
    <None Include="LICENSE.md" Pack="true" PackagePath="" />
  </ItemGroup>

</Project>

Or disable packability:

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

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

</Project>