gpt4 book ai didi

nuget - 上传NuGet包,如何设置许可?

转载 作者:行者123 更新时间:2023-12-01 16:12:02 26 4
gpt4 key购买 nike

我正在尝试在网站上上传新的 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 解决方案或项目。

有什么想法吗?

最佳答案

编辑.csproj 文件。添加以下内容:

使用许可证文件:

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

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

PackagePath="LICENSE.txt"/>
</ItemGroup>

使用 PackageLicenseExpression:

<PropertyGroup>
<PackageLicenseExpression>MIT</PackageLicenseExpression>
</PropertyGroup>

了解更多详情,see

关于nuget - 上传NuGet包,如何设置许可?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57682160/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com