【发布时间】:2020-01-01 01:50:24
【问题描述】:
我正在尝试在网站上上传新的 NuGet 包。
https://www.nuget.org/packages/manage/upload
在第一次尝试时,我收到一条错误消息,提示我需要指定许可证。
我不想要,但是……好吧。
因此,我使用指定许可证的第一次尝试失败了。我阅读了链接的文档,并尝试了多次。
我尝试使用 <license> 属性,并在包中包含 license.txt 文件。
这些是我对 .nuspec 文件的尝试以及我收到的错误:
<license type="MIT"/>
=> Error: Unsupported license type 'MIT'.
(I know it is wrong but I found this "example" here: https://github.com/NuGet/Home/wiki/Packaging-License-within-the-nupkg)
<license type="expression">MIT</license>
=> Error: To provide a better experience for older clients when a license expression is specified, must be set to 'https://licenses.nuget.org/MIT'.
<license type="expression">BSD-2-Clause OR MIT</license>
=> Error: To provide a better experience for older clients when a license expression is specified, must be set to 'https://licenses.nuget.org/BSD-2-Clause%20OR%20MIT'.
<license type="expression">https://licenses.nuget.org/MIT</license>
=> Error: Invalid license metadata: The license expression 'https://licenses.nuget.org/MIT' contains invalid characters.
我也尝试使用我的 license.txt,但没有成功。
我正在做的是:修改生成的 mylibrary.nupkg 中包含的 mylibrary.nuspec 文件,添加 <license> 字段。
为什么?因为这个 VS studio 项目使用 nuget.exe mylibrary.csproj 文件生成包,并且它不包含许可证。
我更新了 nuget.exe 到最新的 5.1 版本,但是我不想修改 VS 解决方案或项目。
有什么想法吗?
【问题讨论】:
-
这些错误是在您上传到 nuget.org 时出现的?当我使用
nuget pack时没有看到这些错误。我认为 2) 和 3) 的错误只是说您还应该为老客户包含旧样式的 licenseUrl 元素。 -
nuget 包很好,没有错误。当我使用网站上传页面时出现这些错误。 --- “licenseUrl 已被弃用。请改用许可证。” docs.microsoft.com/en-us/nuget/reference/nuspec#license
-
我会将这个提交给 NuGetGallery - github.com/NuGet/NuGetGallery/issues