tags:

views:

23

answers:

2

Hi,

Placing this in our AssemblyInfo.cs:

[module: SuppressMessage("Microsoft.Performance",
"CA1822:MarkMembersAsStatic", Scope="member",
Target="Foo.CoreTest.StringUtilTest.CapitalizeNull():System.Void")]

Results in CA1822 being excluded for the method Foo.CoreTest.StringUtilTest.CapitalizeNull. However we would like CA1822 to be excluded from the assembly as a whole.

Is it possible from source? And if so, how should we change our suppression line above?

A: 

Scope = Module, I think

Preet Sangha
A: 

No, it is not possible to apply a module-level suppression that will act against the entire assembly. You need to add a single suppression per rule violation target, regardless of whether the suppression attribute is applied directly against the target or at the module level.

If you don't want to run the rule against the assembly, remove it from the analysis rules for the assembly instead of trying to exclude each violation.

Nicole Calinoiu