我尝试在一个蛋糕脚本中指定nuget包的许可证。
以下代码不起作用--它没有在nuget包中放入任何许可证,我也找不到任何文档来正确地指定它:
var msbuildsettings = new DotNetCoreMSBuildSettings();
msbuildsettings = msbuildsettings.WithProperty("PackageLicenseExpression", "'LGPL-2.0-or-later'");
var settings = new DotNetCorePackSettings
{
MSBuildSettings = msbuildsettings,
Configuration = "Release",
OutputDirectory = "BuildOutput/NugetPackages",
NoBuild = true,
};
foreach(var gassembly in list)
DotNetCorePack(gassembly.Csproj, settings);发布于 2020-03-03 16:09:08
我不确定这是一个蛋糕的问题。Cake只是包装了现有的工具。
NuGet文档告诉您如何指定包元数据。在使用dotnet pack时,您通常希望在csproj中指定元数据
https://docs.microsoft.com/en-us/dotnet/core/tools/csproj#nuget-metadata-properties
发布于 2020-08-12 23:23:37
PackageLicenseExpression属性的值应为不带任何撇号的有效SPDX license identifier字符串。
只需删除撇号,您的代码就可以正常工作,并将许可证表达式添加到NuGet包中。
msbuildsettings = msbuildsettings.WithProperty("PackageLicenseExpression", "LGPL-2.0-or-later");https://stackoverflow.com/questions/60495373
复制相似问题