如何在从项目文件构建的NuGet包中包含XML文档文件?

编程入门 行业动态 更新时间:2024-10-26 21:19:24
本文介绍了如何在从项目文件构建的NuGet包中包含XML文档文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我认为,将C#生成的XML文档文件与DLL一起包含在NuGet包中,以为消费者提供智能感知文档,通常是一种好习惯.

I consider it generally good practice to include the XML documentation file generated by the C# build in NuGet packages alongside the DLLs to provide intellisense documentation for consumers.

但是,我不清楚使用VS 2017的项目文件格式构建软件包时如何做到这一点.

However, it's not clear to me how this can be done when building a package using VS 2017's project file format.

这可能吗?

很明显,我可以切换到维护nuspec文件,但是VS2017格式对于将版本和依赖项全部保存在一个地方非常方便.

Obviously I could switch over to maintaining a nuspec file but the VS2017 format is very convenient for keeping versions and dependencies all in one place.

推荐答案

只要您在csproj文件中设置GenerateDocumentationFile就像这样:

As long as you set GenerateDocumentationFile in your csproj file like this:

<Project Sdk="Microsoft.NET.Sdk"> <PropertyGroup> <TargetFramework>netstandard2.0</TargetFramework> <GenerateDocumentationFile>true</GenerateDocumentationFile> </PropertyGroup> </Project>

然后所有默认设置都会在正确的位置生成文档文件,并将其包含在NuGet软件包中.

then all the defaults will generate the documentation file at the correct location and it will be included in the NuGet package.

如果Visual Studio添加了DocumentationFile或其他元素,则可以删除它们并将其替换为单个GenerateDocumentationFile属性.

If Visual Studio added DocumentationFile or other elements, you can delete them and replace it with the single GenerateDocumentationFile property.

更多推荐

如何在从项目文件构建的NuGet包中包含XML文档文件?

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

发布评论

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

>www.elefans.com

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