To ensure the creation of well-formed NuGet packages
and for maximum compatibility with external tools, explicitly define the
<PackageLicenseExpression>
or <PackageLicenseFile>
node. Alternatively
disable package generation by defining the <IsPackable>
node with value false
.
The value of the <PackageLicenseExpression>
tag must be a SPDX license
identifier. A full list can be found on spdx.org.
Also see licenses.nuget.org.
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<IsPackable>true</IsPackable>
</PropertyGroup>
</Project>
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<IsPackable>true</IsPackable>
<PackageLicenseExpression>MIT</PackageLicenseExpression>
</PropertyGroup>
</Project>
Or:
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<IsPackable>true</IsPackable>
<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>