License expression for commercial nuget package

376 Views Asked by At

I'm uploading a private nuget package to a private nuget repository. The package is commercial (not open source).

The csproj has this:

<PackageLicenseExpression>Commercial</PackageLicenseExpression>

I receive a build warning that the above is not a valid "license expression".

What value do I use?

1

There are 1 best solutions below

0
zivkan On BEST ANSWER

You need to embed your license file, you can't use the license expression: https://learn.microsoft.com/nuget/reference/msbuild-targets#packing-a-license-expression-or-a-license-file

<PropertyGroup>
    <PackageLicenseFile>LICENSE.txt</PackageLicenseFile>
</PropertyGroup>

<ItemGroup>
    <None Include="licenses\LICENSE.txt" Pack="true" PackagePath=""/>
</ItemGroup>

NuGet's license expressions use SPDX identifiers, and I don't see any "generic" commercial license.