我正在为C#类库创建一个NuGet包,我想在库中包含生成的Xml文档.这是我的nuspec文件:
<?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>
Run Code Online (Sandbox Code Playgroud)
当我使用此命令构建包时:
nuget pack MyLibrary.nuspec
Run Code Online (Sandbox Code Playgroud)
它会产生错误.如果我删除该行:
<file src="..\..\build\MyLibrary.xml" target="lib\Net40" />
Run Code Online (Sandbox Code Playgroud)
NuGet.exe成功创建了nupkg.我甚至可以解压缩包,并验证内容是否正确.我究竟做错了什么?xml文件应该进入不同的目标目录吗?
但是,当我将包包含在.NET Core 2.2 应用程序中时,注释在IntelliSense中不可用。
我在包或我的应用程序中是否缺少某些内容以便能够使用 IntelliSense 查看文档?
使用VisualStudio 2017,Windows 10 .
清晰度更新
NuGet 包是一个.NET Standard 1.3类库。在 Visual Studio 中,当我构建项目时,我包含了用于生成包和文档文件的选项。在项目文件中,我看到以下 PropertyGroup:
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'">
<DocumentationFile>C:\Users\[username]\[local path]\CommonEntities\CommonEntities\CommonEntities.xml</DocumentationFile>
</PropertyGroup>
Run Code Online (Sandbox Code Playgroud)
当我打开包时,我可以在lib/netstandard1.3/目录中看到CommonEntities.xml与MakanalTech.CommonEntities.dll一起包含在内。
但是,我想知道为什么 xml 文件将项目中的MakanalTech.CommonEntities.xml的全名删除到包中的CommonEntities.xml。也许这就是问题的原因?
问题是当我将包作为依赖项包含在另一个项目中时,没有任何 XML 注释/文档是可见的。因此,我无法将鼠标悬停在类型上以查看其描述,并且如果我查看定义,则定义中没有任何注释/文档。
类库产品 https://imgur.com/zbE7ngM(暂时不能发图)
查看其他项目的定义:https : //imgur.com/pwmvpX7
intellisense asp.net-core-mvc .net-core asp.net-core visual-studio-2017