c# - 如何抑制 StyleCop 警告 SA1649

标签 c# stylecop

我试图在 StyleCop 中抑制 SA1649 错误的两次出现。

根据documentation抑制属性看起来像下面的属性

[SuppressMessage("StyleCop.CSharp.DocumentationRules", "SA1649:FileHeaderFileNameDocumentationMustMatchTypeName", Justification = "Reviewed.")]

但是,我不知道应该将属性应用到哪个元素。如果我将属性放在文件的第一个元素(IClassFactory 接口(interface))上,我会收到以下错误:

SA1649 : CSharp.Documentation : The file attribute in the file header's copyright tag must contain the name of the first type in the file and can be any of these: "IClassFactory" C:(...)COMHelper.cs

可以抑制该错误吗?它应该应用于什么元素?

最佳答案

使用命名空间级别抑制:

[module: System.Diagnostics.CodeAnalysis.SuppressMessage("StyleCop.CSharp.DocumentationRules", "SA1649:FileHeaderFileNameDocumentationMustMatchTypeName", Justification = "Reviewed.")]

namespace MyNamespace
{

}

关于c# - 如何抑制 StyleCop 警告 SA1649,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23019604/

相关文章:

c# - 矩阵的左上象限的最大和可以通过反转行和列来形成

c# - 需要 SQL 帮助复制行

c# - 如何制作完全由用户定义的自定义 GridView

C# ListBox Selected Item Null异常

.net - 为特定行禁用 StyleCop

c# - 正确删除 StyleCop R# 插件

c# - Serilog LogContext 与 Owin 中的 Enrich

visual-studio-2010 - 如何将 stylecop 检查作为预构建操作添加到 VS2010?

resharper - 禁用自动文件头创建(ReSharper 和 StyleCop)

c# - 试图抑制 StyleCop 消息 SA1513 :ClosingCurlyBracketMustBeFollowedByBlankLine