【问题标题】:"StyleCop "SA1300 is not suppressing in GlobalSuppressions.cs class“StyleCop”SA1300 未在 GlobalSuppressions.cs 类中抑制
【发布时间】:2015-03-17 09:20:39
【问题描述】:

我正在尝试通过这行代码抑制 SA1300 的 Style Cope 警告。

[SuppressMessage("StyleCop.CSharp.NamingRules","SA1300:ElementMustBeginWithUpperCaseLetter", Justification = "Reviewed.")] 

它在类级别上工作(即,如果我把它放在有警告的类中然后它的工作)但如果我把它放在 GlobalSuppressions.cs 类中就不起作用。我想禁止整个程序集的 SA1300 警告,所以我将这一行放在 GlobalSuppressions.cs 中,但它不起作用。

[assembly: SuppressMessage("StyleCop.CSharp.NamingRules","SA1300:ElementMustBeginWithUpperCaseLetter", MessageId = "Ctl", Scope = "namespace", Target = "Assembly name"))]

是否可以在“GlobalSuppressions.cs”中做到这一点? 它也不适用于“SA1600”

【问题讨论】:

    标签: c# .net stylecop


    【解决方案1】:

    我刚遇到同样的问题,所以想我会给你我的结果。

    [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.StyleCop.CSharp.NamingRules", "SA1300:ElementMustBeginWithUpperCaseLetter", Justification = "Auto generated name")]
    

    我注意到您的 StyleCop 命名空间不是完全限定的。应该是“Microsoft.StyleCop.CSharp.NamingRules”

    【讨论】:

      猜你喜欢
      • 2015-04-20
      • 1970-01-01
      • 1970-01-01
      • 2011-03-18
      • 2012-11-11
      • 1970-01-01
      • 2011-11-07
      • 2023-04-10
      相关资源
      最近更新 更多