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?
基础教程推荐
- 如何使用 .Net 检查 Active Directory 服务器是否已启动并正在运行? 2022-01-01
- 我应该在后面的代码中直接使用 Linq To SQL 还是使 2022-01-01
- 禁止输入少量字符,例如'<'、'&a 2022-01-01
- 当值可以是对象或空数组时反序列化 JSON 2022-01-01
- 如果有人提交恶意软件Nuget包怎么办? 2022-01-01
- Azure Functions:CosmosDBTrigger 未在 Visual Studio 中触发 2022-01-01
- .NET SerialPort DataReceived 事件未触发 2022-01-01
- C# 从 List<List<int>> 中删除重 2022-01-01
- Moq It.Is<>不匹配 2022-01-01
- WPF 模态进度窗口 2022-01-01
