Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to ignore a class when generating XML documentation for a Visual Studio project?

I have a Visual Studio (C#) project in which the "XML documentation file" property is enabled. It also has "Treat warnings as errors" set to All.

There is one particular class which has no XML comments and they will not be added to it. Since XML documentation and warnings as errors are enabled, this causes builds to fail.

Is there a way to ignore this specific class when it comes to XML documentation?

like image 651
brett rogers Avatar asked Jul 31 '09 18:07

brett rogers


People also ask

How to generate XML documentation Visual Studio?

From the menu bar, choose Tools > Options to open the Options dialog box. Then, navigate to Text Editor > C# (or Visual Basic) > Advanced. In the Editor Help section, look for the Generate XML documentation comments option.

What is XML documentation in C#?

The C# compiler combines the structure of the C# code with the text of the comments into a single XML document. The C# compiler verifies that the comments match the API signatures for relevant tags. Tools that process the XML documentation files can define XML elements and attributes specific to those tools.


1 Answers

In the class file, place a pragma at the top of the file to disable the given warning number.

#pragma warning disable (warning #)

The error number for xml documentation warnings is 1591, so it looks like:

#pragma warning disable 1591
like image 171
womp Avatar answered Sep 29 '22 00:09

womp