Search code examples
c#visual-studio-2019xml-commentseditorconfig

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


is it possible to configure an .editorconfig file to display warnings/errors on items with missing XML documentation?

It would be great to see such warnings in the editor.

Thanks in advance.


Solution

  • If you add the <GenerateDocumentationFile>true</GenerateDocumentationFile> property in your project file (or Directory.Build.props), and have your warning level set to at least 4 (the default), that will enable warnings for CS1591 (Missing XML comment for publicly visible type or member 'Foo').

    You can also get additional rules by adding the StyleCop.Analyzers NuGet package, which has a whole bunch of rules outlined here (these SA16xx rules also need the same project property enabled, or else you'll get an SA0001 warning).

    These all apply to publicly exposed APIs, I'm not sure how to configure them for non-public APIs.