
258
|
Chapter 7, Help and Research
#65 Follow the Rules with FxCop
HACK
FxCop fixed this major annoyance, so you can continuously run Visual Stu-
dio and FxCop side by side.
To see your number of FxCop messages decrease, make the necessary code
changes in Visual Studio, recompile, then flip back over to FxCop and hit
the F5 key to reanalyze your assembly. In our example, I’m going to fix two
messages: “Declare types in namespaces” and “Identifiers should be cased
correctly”. After fixing these two issues, my FxCop results look like
Figure 7-30.
A Look at the Rules
Now that you’ve seen how to use FxCop and what it’s good for, you must
be wondering where all those rules are and whether you really need to ana-
lyze all your assemblies against every single rule FxCop has. The answer is
no. Although that is strongly suggested, the FxCop team understands that
not everyone can abide by all the rules set forth in the .NET Framework
Design Guidelines all the time. Therefore, they’ve made it very easy to pick
and choose which rules will be used in the analysis of your .NET assem-
blies. By default, all rules are used during the analysis, but that can be easily
changed.
To see the rules, click the Rules tab in the left pane of FxCop. You will see
Figure 7-31.
Notice that all rules are expandable and can be checked or unchecked as
needed. For instance, if you choose to ignore all interoperability rules, you
would