你如何包含XML文档在一个包中的NuGet类库? [英] How do you include Xml Docs for a class library in a NuGet package?
问题描述
我创建的NuGet包一个C#类库,我想包括与库生成的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="..\..\build\MyLibrary.dll" target="lib\Net40" />
<file src="..\..\build\MyLibrary.xml" target="lib\Net40" />
</files>
</package>
在我的建立包用这个命令:
nuget pack MyLibrary.nuspec
它会产生一个错误。如果我删除行:
It generates an error. If I remove the line:
<file src="..\..\build\MyLibrary.xml" target="lib\Net40" />
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.
这篇关于你如何包含XML文档在一个包中的NuGet类库?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!