当前位置: 移动技术网 > IT编程>开发语言>.net > 新版的nuget包 PackageLicense 这样写

新版的nuget包 PackageLicense 这样写

2019年01月01日  | 移动技术网IT编程  | 我要评论

双城生活下载,colorcorrect.dlm,张宇辰

intro

最近编译类库项目的时候发现总是有个 licenseurl 的警告,警告信息如下:

 warning nu5125: the 'licenseurl' element will be deprecated. consider using the 'license' element instead

本文针对的是使用新版项目文件打包的方式,*.nuspec 官方文档详细,在此不多说。
新版的官方文档里基本没有提及,不过 github 有个 samples 项目,可以参考。
新版项目文件的 nuget 包原来可以指定一个 packagelicenseurl 来指定这个包的 license, 现在不再支持了,现在有两种方式可以指定,一种是 licenseexpression 一种是 licensefile

licenseexpression

示例:

<project sdk="microsoft.net.sdk">
  <propertygroup>
    <targetframework>netstandard2.0</targetframework>
   <packagelicenseexpression>mit</packagelicenseexpression>
   <!-- <packagelicenseexpression>apache-2.0</packagelicenseexpression> -->
  </propertygroup>
</project>

更多license列表可以参考:

licensefile

增加 license file,具体的 license 写在 license file 内,并配置打包,然后配置 packagelicensefile

<project sdk="microsoft.net.sdk">
  <propertygroup>
    <targetframeworks>netstandard2.0</targetframeworks>
    <packagelicensefile>license.txt</packagelicensefile>
  </propertygroup>
  <itemgroup>
    <none include="license.txt" pack="true" visible="false" packagepath=""/>
  </itemgroup>
</project>

reference

如对本文有疑问,请在下面进行留言讨论,广大热心网友会与你互动!! 点击进行留言回复

相关文章:

验证码:
移动技术网