作者热门文章
- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我正在尝试在网站上上传新的 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/
我有以下正则表达式 /[a-zA-Z0-9_-]/ 当字符串只包含从 a 到z 大小写、数字、_ 和 -。 我的代码有什么问题? 能否请您向我提供一个简短的解释和有关如何修复它的代码示例? //var
我是一名优秀的程序员,十分优秀!