NuGet 包 XML 文档在 .NET Core 2.2 应用程序中不可见 [英] NuGet package XML documentation not visible in .NET Core 2.2 app

查看:23
本文介绍了NuGet 包 XML 文档在 .NET Core 2.2 应用程序中不可见的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用 NuGet 包,它有一个 XML 文档文件.

I am using a NuGet package which has an XML documentation file.

但是当我将包包含在 .NET Core 2.2 应用中时,IntelliSense 无法使用这些注释.

But when I include the package in a .NET Core 2.2 app, the comments are not available with IntelliSense.

我在包或我的应用程序中是否遗漏了一些东西,以便能够使用 IntelliSense 查看文档?

Is there something I'm missing either in the package or in my app to be able to see the documentation with IntelliSense?

使用 VisualStudio 2017、Windows 10.

清晰度更新

NuGet 包是一个 .NET Standard 1.3 类库.在 Visual Studio 中,当我构建项目时,我包含了生成包和文档文件的选项.在项目文件中,我看到以下 PropertyGroup:

The NuGet package is a .NET Standard 1.3 class library. In Visual Studio when I build the project, I include the options to generate the package and documentation file. In the project file, I see the following PropertyGroup:

<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'">
    <DocumentationFile>C:Users[username][local path]CommonEntitiesCommonEntitiesCommonEntities.xml</DocumentationFile>
</PropertyGroup>

当我打开包时,我可以在 lib/netstandard1.3/ 目录中看到 CommonEntities.xmlMakanalTech.CommonEntities 一起包含在内.dll.

When I open the package, I can see in the lib/netstandard1.3/ directory that CommonEntities.xml is included along with MakanalTech.CommonEntities.dll.

但是,我想知道为什么 xml 文件将项目中的 MakanalTech.CommonEntities.xml 中的全名删除到 CommonEntities.xml 中包.也许这就是问题的原因?

But, I'm wondering why the xml file has dropped the full name from MakanalTech.CommonEntities.xml as it is in the project to just CommonEntities.xml in the package. Maybe this is the cause of the issue?

问题是,当我将包作为依赖项包含在另一个项目中时,没有任何 XML 注释/文档可见.所以我不能将鼠标悬停在一个类型上来查看它的描述,如果我查看定义没有任何评论/文档在定义中.

The issue is then when I include the package as a dependency in another project, none of the XML comments/documentation are visible. So I can't hover over a type to see its description, and if I peek definition none of the comments/documentation are in the definition.

类库产品https://imgur.com/zbE7ngM(还不能发布图片)

Class Library Product https://imgur.com/zbE7ngM (can't post images yet)

查看其他项目的定义:https://imgur.com/pwmvpX7

推荐答案

终于从这篇帖子中找到了问题.从 Visual Studio 2017 看来,这似乎很麻烦,无法正确自动地处理此问题.

Finally found the issue from this post. This seems quite buggy from Visual Studio 2017 not to handle this correctly and automatically.

在 .csproj 文件中,我删除了 [filepath-to-xml] 并添加了 true代码>.

In the .csproj file, I removed <DocumentationFile>[filepath-to-xml]</DocumentationFile> and added <GenerateDocumentationFile>true</GenerateDocumentationFile>.

然后我重新打包了库,清除了我的 nuget 缓存,并重建了包含它的新项目,现在我可以看到所有的 XML 文档.

I then repacked the library, cleared my nuget cache, and rebuilt the new project where it's included, and now I have all the XML documentation visible.

这篇关于NuGet 包 XML 文档在 .NET Core 2.2 应用程序中不可见的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆