Rizwan Ansari
Rizwan Ansari

Reputation: 439

"StyleCop "SA1300 is not suppressing in GlobalSuppressions.cs class

I am trying to suppress Style Cope warning for SA1300 by this line of code.

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

It is working at class level (i.e. if I put it in class which has warnings then its work) but not working if I put it in GlobalSuppressions.cs class. I want to suppress SA1300 warnings for whole assembly so I put this line in GlobalSuppressions.cs but it’s not working.

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

Is it possible to do it in "GlobalSuppressions.cs"? it is also not working for "SA1600"

Upvotes: 4

Views: 3815

Answers (1)

Lee.Winter
Lee.Winter

Reputation: 710

I just had this same issue so thought I would give you my result.

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

I noticed your StyleCop namespace is not fully qualified. Should be "Microsoft.StyleCop.CSharp.NamingRules"

Upvotes: 11

Related Questions