如何为具有多个目标的CSPROJ生成XML文档

编程入门 行业动态 更新时间:2024-10-27 06:34:00
本文介绍了如何为具有多个目标的CSPROJ生成XML文档的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我有一个有多个目标的图书馆项目,例如在CSPROJ文件中,它具有:

I have a library project that has multiple targets, e.g. in the CSPROJ file it has:

<TargetFrameworks>net40;net46;net461;net462;net47</TargetFrameworks>

如果我想要这些目标框架以及Debug和Release配置的所有组合的XML文档,则必须使用Build Configuration Manager在UI中依次选择每个文档,然后将其设置为为此生成XML文档.组合,然后每个组合在CSPROJ中分别作为PropertyGroup列出,并带有XML文档的预期输出文件.

If I want XML documentation for all combinations of these target frameworks and Debug and Release configurations I have to select each one in turn in the UI using the Build Configuration Manager and then set it to build XML documentation for that combination and each combination is then listed separately as a PropertyGroup in the CSPROJ with the intended output file for the XML documentation.

有更好的方法吗?

发布问题和答案,因为我在网上其他任何地方都找不到此记录

推荐答案

一种简单的方法是将GenerateDocumentationFile属性设置为true. VS UI想要设置路径,如果设置了路径,则MSBuild目标会将此属性设置为true;如果GenerateDocumentationFile属性为true,则将设置默认路径.因此,您可以将其添加到您的csproj文件中:

An easy way is to set the GenerateDocumentationFile property to true. The VS UI want to set the path, the MSBuild targets will set this property to true if the path is set or set a default path if the GenerateDocumentationFile property is true. So you can add this to your csproj file:

<PropertyGroup> <GenerateDocumentationFile>true</GenerateDocumentationFile> </PropertyGroup>

如果要将所有项目共享为true,请创建一个名为 Directory.Build.props ,其中包含以下内容,它将自动导入到以下目录层次结构中的任何项目中:

If you want to set this to true for all your projects to share it, create a file named Directory.Build.props in your solution's directory with the following content and it will be auto-imported into any projects in the directory hierarchy below:

<Project> <PropertyGroup> <GenerateDocumentationFile>true</GenerateDocumentationFile> </PropertyGroup> </Project>

更多推荐

如何为具有多个目标的CSPROJ生成XML文档

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

发布评论

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

>www.elefans.com

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