views:

178

answers:

2

This is an annoyance more than a problem. My project contains a number of autogenerated files (using mgmtclassgen.exe). When I generate the XML documentation, my beautifully commented library is plagued by xml documentation warnings from these autogen files.

Is there a way to either a) suppress generating documentation for these files or b) suppress warning CS1591 just for a set of files? I obviously do not want to modify files that are autogenerated, even if to just add suppression pragmas.

The library and generated code are both in C# and I'm using Visual Studio 2008.

A: 

AFAIK you cannot suppress this warning only for certain files. You could, if these warnings really bothers you, move the autogenerated code to a separate assembly for which you would disable XML documentation.

Darin Dimitrov
A: 

You can disable specific warnings using the #pragma directive, this might suit your purpose. The syntax for disabling the 'missing xml comment' warning is:

#pragma warning disable 1591    // Disable 'missing xml comment' warning

You can re-enable it using the following syntax:

#pragma warning restore 1591    // Restore 'missing xml comment' warning

This allows you to selectively ignore warnings for either part of a file or a complete file.