VS2008: Autogenerated files and XML documentation

匿名 (未验证) 提交于 2019-12-03 08:57:35

问题:

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.

回答1:

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.



回答2:

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.



标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!