【问题标题】:How can a add a custom license to my dotnet nuget package?如何向我的 dotnet nuget 包添加自定义许可证?
【发布时间】:2019-05-11 19:45:31
【问题描述】:

今天我尝试更新我的netstandard2.0 类库,并收到<PackageLicenseUrl> 元素已弃用的警告。经过一番研究,我在csproj 文件中添加了以下几行:

<PackageLicenseFile>LICENSE.txt</PackageLicenseFile>

<!-- .... -->

<ItemGroup>
    <None Include="..\LICENSE.txt" Pack="true" PackagePath="$(PackageLicenseFile)"/>
</ItemGroup>

后来,我尝试发布包。 dotnet pack 运行没有问题,但 dotnet nuget push xxx.1.0.2.nupkg -k xxx -s https://api.nuget.org/v3/index.json 打印以下错误:

info : "xxx.1.0.2.nupkg" wird per Push nach "'https://www.nuget.org/api/v2/package'" übertragen... 信息:PUT https://www.nuget.org/api/v2/package/ warn :您的 API 密钥将在 1 天后过期。访问 https://www.nuget.org/account/apikeys 以重新生成您的 API 密钥。 信息:BadRequest https://www.nuget.org/api/v2/package/ 1661 毫秒 错误:响应状态代码不表示成功:400(尚不支持许可证文件。)。

总结:

  • PackageLicenseUrl 已弃用但可以使用
  • PackageLicenseFile 未实现

我错过了什么吗?

【问题讨论】:

  • 如果您没有收到我编辑/评论我的答案的通知,nuget.org 现在接受带有许可证文件的包。

标签: nuget nuget-package .net-standard dotnet-cli


【解决方案1】:

在 NuGetGallery 取消对该功能的支持之前发布的新 NuGet 客户端。但它应该是coming very soon。如果您使用众所周知的许可证,则可以改用 SDPX 表达式,而 nuget.org 将接受这些。

编辑:nuget.org 现在接受带有许可证文件的包。 Announcement of the new licence feature here.

【讨论】:

  • 编辑后的答案包括 NuGet 新许可功能公告的链接。
猜你喜欢
  • 2013-06-07
  • 2013-07-04
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多