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#MongoDB使用Builders查找派生对象 2022-09-04
- 如何用自己压缩一个 IEnumerable 2022-01-01
- C# 中多线程网络服务器的模式 2022-01-01
- 良好实践:如何重用 .csproj 和 .sln 文件来为 CI 创建 2022-01-01
- WebMatrix WebSecurity PasswordSalt 2022-01-01
- 在哪里可以找到使用中的C#/XML文档注释的好例子? 2022-01-01
- 输入按键事件处理程序 2022-01-01
- 带有服务/守护程序应用程序的 Microsoft Graph CSharp SDK 和 OneDrive for Business - 配额方面返回 null 2022-01-01
- Web Api 中的 Swagger .netcore 3.1,使用 swagger UI 设置日期时间格式 2022-01-01
- MoreLinq maxBy vs LINQ max + where 2022-01-01