如何在 NuGet 包中包含类库的 Xml Docs?

编程入门 行业动态 更新时间:2024-10-26 17:28:02
本文介绍了如何在 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?

本文发布于:2023-11-17 03:52:46,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1608730.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:包中   类库   如何在   Docs   NuGet

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!