Game Development Reference
the build process, you can also stick to running FxCop on a daily basis instead.
This is the approach that Microsoft is pushing to its developers. The longer you
wait between each running of FxCop, the more possible violations will have been
amassed, resulting in more time spent fixing these issues. Making FxCop an inte-
gral part of your work schedule ensures increased familiarity with the guidelines
and eases the design work. For example, imagine that you create a property which
is named in such a way that it does not follow design guidelines. With FxCop inte-
grated with your build process, you would notice this violation immediately the
next time your post-build process executes. If instead, you run FxCop on a week-
ly basis, you would have to go back and modify a week's worth of work in all places
where that property was accessed. There are increased productivity benefits when
running FxCop analysis as often as possible.
Creating an FxCop Project
The first thing to do is create an FxCop project where you can select the assemblies
to target for analysis, and specify the rules to enforce. Launch the FxCop tool and
start adding assemblies through the Project>Add Targets menu, or by using the
Ctrl+Shift+A hotkey. Once you have selected the assemblies you want to analyze,
you should end up with a window similar to Figure 13.1.
The left tree view shows the hierarchy of the loaded assemblies and the compo-
nents available for analysis. You can uncheck code that you do not want analyzed,
though it is recommended that you only do so if absolutely necessary.
The right view pane has a list view that will populate with rule violations once
analysis has been completed. The bottom view pane will display detailed informa-
tion about a rule violation when one has been selected in the violations list view.
Once the target assemblies have been added to the project, you are now at the
point where you can configure the rules engine for the project.
Configuring Built-In Rules
Now that the FxCop project has been created and assemblies have been targeted
for analysis, it is time to move on to the configuration of the rules engine. Some
people stick to the default configuration, but many developers customize the con-
figuration to suit their own preferences where applicable.
The left view pane contains a tab control with a Rules tab. Selecting that tab will pre-
sent a listing of the available rules that can be enforced upon the targeted assemblies,
and each rule can be enabled or disabled using the checkbox to the left of the rule.