How do you include Xml Docs for a class library in a NuGet package?(如何在 NuGet 包中包含类库的 Xml Docs?)
问题描述
我正在为 C# 类库创建一个 NuGet 包,并且我想将生成的 Xml 文档包含在该库中.这是我的 nuspec 文件:
I am creating a NuGet package for a C# class library, and I would like to include generated Xml Documentation with the library. This is my nuspec file:
<?xml version="1.0" encoding="utf-8"?>
<package>
<metadata>
<id>MyLibrary</id>
<version>1.0.0.0</version>
<authors>John Nelson</authors>
<language>en-US</language>
<description>A C# class library</description>
</metadata>
<files>
<file src="....uildMyLibrary.dll" target="libNet40" />
<file src="....uildMyLibrary.xml" target="libNet40" />
</files>
</package>
当我使用此命令构建包时:
nuget pack MyLibrary.nuspec
它会产生错误.如果我删除该行:
It generates an error. If I remove the line:
<file src="....uildMyLibrary.xml" target="libNet40" />
NuGet.exe 成功创建 nupkg.我什至可以解压缩包,并验证内容是否正确.我究竟做错了什么?xml文件是否应该进入不同的目标目录?
NuGet.exe successfully creates the nupkg. I can even unzip the package, and verify that the contents are correct. What am I doing wrong? Should the xml file go into a different target directory?
推荐答案
问题是我没有检查我正在使用的构建配置的生成 Xml 文档".那个 nuspec 是正确的.
The problem was that I didn't check "Generate Xml Documentation" for the build configuration I was using. That nuspec is correct.
这篇关于如何在 NuGet 包中包含类库的 Xml Docs?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:如何在 NuGet 包中包含类库的 Xml Docs?
基础教程推荐
- 从 C# 控制相机设备 2022-01-01
- 将数据集转换为列表 2022-01-01
- C# 9 新特性——record的相关总结 2023-04-03
- 获取C#保存对话框的文件路径 2022-01-01
- 更新 Visual Studio 中的 DataSet 结构以匹配新的 SQL 数据库结构 2022-01-01
- SonarQube C# 分析失败“不是指针的有效行偏移" 2022-01-01
- Mono https webrequest 失败并显示“身份验证或解密失败" 2022-01-01
- 如果条件可以为空 2022-01-01
- 在 VB6 或经典 ASP 中使用 .NET 2022-01-01
- 重新排序 WPF TabControl 中的选项卡 2022-01-01
