如何为具有多个目标的CSPROJ生成XML文档 [英] How to generate XML documentation for CSPROJ with multiple targets

查看:122
本文介绍了如何为具有多个目标的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>

如果我想要这些目标框架以及DebugRelease配置的所有组合的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,请创建一个名为

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文档的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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