在 .editorconfig 中配置针对 xml 注释错误的警告(Visual Studio 2019)

Configure warnings for mising xml comments in .editorconfig (Visual Studio 2019)

是否可以配置 .editorconfig 文件以在缺少 XML 文档的项目上显示 warnings/errors?

如果能在编辑器中看到这样的警告就好了。

提前致谢。

如果您在项目文件(或 Directory.Build.props)中添加 <GenerateDocumentationFile>true</GenerateDocumentationFile> 属性,并且 warning level set to at least 4 (the default), that will enable warnings for CS1591(缺少 XML 评论 public可见类型或成员 'Foo').

您还可以通过添加 StyleCop.Analyzers NuGet package, which has a whole bunch of rules outlined here 来获取其他规则(这些 SA16xx 规则也需要启用相同的项目 属性,否则您将收到 SA0001 警告)。

这些都适用于 public 公开的 API,我不确定如何为非 public API 配置它们。