
260
|
Chapter 7, Help and Research
#65 Follow the Rules with FxCop
HACK
Another item of note about the Rules view is that you can begin to see how
your rules violations are categorized. For example, if you wanted to know
how many of your overall number of messages were based on design issues,
you would switch to the Rules view and select Design Rules, as shown in
Figure 7-33. This view shows that five messages of my overall issues were
generated from the design rules.
Visual Studio Integration
Up to this point, I’ve demonstrated the preferred way of using FxCop. How-
ever, FxCop provides a command-line interface that can be used from
within Visual Studio.
The first thing that you must do is to set up FxCop as an external tool in
Visual Studio
[Hack #33]. To do this:
1. Start an instance of Visual Studio.
2. Click File
➝ Tools ➝ External Tools ➝ Add.
3. In the Title box, enter
FxCop.
4. In the Command box, enter
C:\Program Files\Microsoft FxCop 1.312\
FxCopCmd.exe
. (The actual path will vary based on the version of FxCop
and where you installed it.)
5. In the Arguments box, enter:
/c /f:$(TargetPath) /r:"C:\Program Files\Microsoft FxCop 1.312\Rules"
6. You can leave the Initial Directory box empty.
Figure 7-33. Messages specific for design rules