简体   繁体   English

DocumentationFile和GenerateDocumentationFile可以在.Net项目文件中一起使用吗?

[英]Can DocumentationFile and GenerateDocumentationFile be used together in .Net project file?

I'm writing a small analyzer for C# projects that checks if the XML documentation generation is present and set up correctly.我正在为 C# 项目编写一个小型分析器,用于检查 XML 文档生成是否存在并正确设置。 There are two options for to specify XML documentation:有两个选项可以指定 XML 文档:

  • An older DocumentationFile option较旧的DocumentationFile选项
  • A newer GenerateDocumentationFile flag.更新的GenerateDocumentationFile标志。 If the flag is set to true MSBuild should generate a XML documentation file with the project's name in the project's output directory.如果该标志设置为 true MSBuild 应该在项目的 output 目录中生成带有项目名称的 XML 文档文件。

Can both of these options be specified explicitly in the project file?可以在项目文件中明确指定这两个选项吗? Will the values from these options be combined or one of the options will be ignored?这些选项的值是否会被组合,或者其中一个选项将被忽略?

They both don't need to be set.它们都不需要设置。 If DocumentationFile is not empty, then GenerateDocumentationFile will set to true in an MSBuild target.如果DocumentationFile不为空,则GenerateDocumentationFile将在 MSBuild 目标中设置为true

If you set GenerateDocumentationFile to true , then a default value for DocumentationFile will be set based on the project file name.如果将GenerateDocumentationFile设置为true ,则会根据项目文件名设置DocumentationFile的默认值。

Relevant MSBuild targets相关 MSBuild 目标

  <!-- Handle XML documentation file settings -->
  <PropertyGroup Condition="'$(GenerateDocumentationFile)' == ''">
    <GenerateDocumentationFile Condition="'$(DocumentationFile)' == ''">false</GenerateDocumentationFile>
    <GenerateDocumentationFile Condition="'$(DocumentationFile)' != ''">true</GenerateDocumentationFile>
  </PropertyGroup>

  <PropertyGroup Condition="'$(GenerateDocumentationFile)' == 'true' and '$(DocumentationFile)' == ''">
    <DocumentationFile Condition="'$(MSBuildProjectExtension)' == '.vbproj'">$(AssemblyName).xml</DocumentationFile>
    <DocumentationFile Condition="'$(MSBuildProjectExtension)' != '.vbproj'">$(IntermediateOutputPath)$(AssemblyName).xml</DocumentationFile>
  </PropertyGroup>

  <PropertyGroup Condition="'$(GenerateDocumentationFile)' != 'true'">
    <DocumentationFile />
  </PropertyGroup>

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 GroupBy 和 concat 不能一起用吗? - Can GroupBy and concat not be used together? Windows 和 Linux 开发人员可以使用 C# 和 Z5E37C7DCD3ADD0070AA9F3D1A9 在同一个项目上一起工作吗? - Can Windows and Linux developers work together on the same project using C# and ASP.net? .NET 中另一个项目使用的项目中引用的 DLL - DLLs referenced in a project used by another project in .NET 设置后,如何设置要在我的c#.net项目中使用的源文件的路径? - How to set a path for the source file to be used in my c# .net project after the setup? 无法从项目目录(asp.net)下载文件 - Can not download file from project directory (asp.net) Asp.net OnClick事件和OnClientClick事件一起使用 - Asp.net OnClick event and OnClientClick event used together (Visual Studio) 如何将 powershell 脚本导入 c# 项目,以便我可以将 .NET 应用程序与脚本一起发布 - (Visual Studio) How to import powershell scripts into c# project so that I can publish my .NET application together with the scripts 错误进程无法访问该文件,因为在 .NET Core 上通过 CLI 构建项目时该文件正被另一个进程使用 - Error the process cannot access the file because it is being used by another process while building project by CLI on .NET Core ASP.NET无法对文件执行操作,因为它正在被另一个进程使用? - ASP.NET Can't Perform Operation on file because it is being used by another process? C ++和.NET在诸如银行,医疗保健和电信等领域一起使用 - Is C++ and .NET used together in Domains like Banking , Health Care and Telecom
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM