制作一个长<Description>
值的NuGet包,会发出以下警告。
... \NuGet.Build.Tasks.Pack.targets(204,5): warning : Issue found with package 'ClassLibrary1'.
... \NuGet.Build.Tasks.Pack\build\NuGet.Build.Tasks.Pack.targets(204,5): warning : Issue: Consider providing Summary text.
... \NuGet.Build.Tasks.Pack\build\NuGet.Build.Tasks.Pack.targets(204,5): warning : Description: The Description text is long but the Summary text is empty. This means the Description text will be truncated in the 'Manage NuGet Packages' dialog.
... \NuGet.Build.Tasks.Pack\build\NuGet.Build.Tasks.Pack.targets(204,5): warning : Solution: Provide a brief summary of the package in the Summary field.
但项目属性页面上没有Summary
字段......
如何设置Summary
字段?
答案 0 :(得分:2)
如何设置摘要字段?
要解决这些警告,您可以通过在NoPackageAnalysis
文件中将.csproj
属性设置为true来禁用这些警告:
<NoPackageAnalysis>true</NoPackageAnalysis>
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
<NoPackageAnalysis>true</NoPackageAnalysis>
</PropertyGroup>
</Project>
然而,我想分享有关此问题的更多信息。根据{{3}}:
description 用于UI显示的包的详细说明。
摘要 UI显示包的简短说明。如果省略,则使用截断版本的描述。
正如摘要描述“如果省略,则使用截断版本的描述”,因此如果我们没有为摘要设置值,则在Visual Studio UI中使用截断的描述版本如果描述太长,它会折叠它以适应空间:
要解决此警告,我们可以在<summary>Value</summary>
文件中添加.nuspec
:
<?xml version="1.0"?>
<package >
<metadata>
<id>MyModels</id>
<version>1.0.0</version>
<authors>Admin</authors>
<owners>Admin</owners>
<requireLicenseAcceptance>false</requireLicenseAcceptance>
<summary>Package description for summary</summary>
<description>This is a long description.This is a long description.This is a long description.This is a long description.This is a long description.This is a long description.This is a long description.This is a long description.This is a long description.This is a long description.This is a long description.This is a long description.This is a long description.This is a long description.This is a long description.This is a long description.This is a long description.This is a long description.This is a long description.This is a long description.This is a long description.This is a long description.This is a long description.This is a long description.This is a long description.This is a long description.This is a long description.This is a long description.This is a long description.This is a long description.This is a long description.This is a long description.This is a long description.</description>
<releaseNotes>Summary of changes made in this release of the package.</releaseNotes>
<copyright>Copyright 2018</copyright>
<tags>Tag1 Tag2</tags>
</metadata>
<files>
<file src="bin\Debug\netcoreapp2.0\MyModels.dll" target="lib\netcoreapp2.0" />
<file src="bin\Debug\netcoreapp2.0\MyModels.xml" target="lib\netcoreapp2.0" />
</files>
</package>
然后打包此.nupsec
,用于UI显示的包的简短描述<summary>Package description for summary</summary>
:
但是
摘要已弃用.NET Core项目,并且没有计划 目前把它带回来。
这就是项目属性页面上没有“摘要”字段的原因。 NuGet团队将关闭将删除netcore项目的此警告。
要跟踪此问题,请查看以下链接:
希望这有帮助。