Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

c#

.net

stylecop

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"

like image 613
Rizwan Ansari Avatar asked Oct 20 '25 02:10

Rizwan Ansari


1 Answers

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"

like image 162
Lee.Winter Avatar answered Oct 22 '25 16:10

Lee.Winter