Visual Studio禁用缺少的XML注释警告
问题描述:
我的项目中有500多个Missing XML Comment
警告.我知道我可以删除XML注释功能,也可以在任何地方粘贴空的注释片段,但是我更喜欢一种通用解决方案,在该解决方案中我可以进行更改以禁用所有此类警告.
I have a project with over 500 Missing XML Comment
warnings. I know I can remove the XML Comment feature, or paste empty comment snippets everywhere, but I'd prefer a generic solution where I can make one change that disables all warnings of this type.
我刚才所做的是
///<Summary>
///
///</Summary>
或
#pragma warning disable 1591
只是好奇是否有可能.
答
如上所述,通常我不认为这些警告应该被忽略(抑制).总而言之,警告的解决方法是:
As suggested above, in general I don't think that these warnings should be ignored (suppressed). To summarise, the ways around the warning would be to:
- 通过输入1591更改项目
Properties
>Build
>Errors and warnings
>Suppress warnings
来取消警告 - 添加XML文档标签( GhostDoc 对此非常方便)
- 通过编译器选项禁止显示警告
- 取消选中项目
Properties
>Build
>Output
中的"XML文档文件"复选框.
- 在各个文件的顶部添加
#pragma warning disable 1591
,在底部的文件中添加#pragma warning restore 1591
- Suppress the warning by changing the project
Properties
>Build
>Errors and warnings
>Suppress warnings
by entering 1591 - Add the XML documentation tags (GhostDoc can be quite handy for that)
- Suppress the warning via compiler options
- Uncheck the "XML documentation file" checkbox in project
Properties
>Build
>Output
- Add
#pragma warning disable 1591
at the top of the respective file and#pragma warning restore 1591
at the bottom