Udostępnij za pośrednictwem


Overview of FxCop

FxCop analyzes programming elements in managed assemblies, called targets, and provides an informational report that contains messages about the targets, Messages include suggestions about how to improve the source code used to generate them. FxCop represents the checks it performs during an analysis as rules. A rule is managed code that can analyze targets and return a message about its findings. Rule messages identify any relevant programming and design issues and, when possible, supply information about how to fix the target.

Using FxCop, you can perform the following tasks:

  • Control which rules are applied to targets.

  • Exclude a rule message from future reports.

  • Apply style sheets to FxCop reports.

  • Filter and save messages.

  • Save and reuse application settings in FxCop projects.

Working in the FxCop Application Window

The FxCop application window displays the targets and rules included in a project, and the messages that are generated when an analysis is performed. The window is divided into three major areas: the configuration pane on the left, the messages pane on the right, and the properties pane at the bottom, as shown in the following screen shot.

FxCop application window

FxCop Application Window

The configuration pane displays targets and rules for the current project in a tree view.

The messages pane displays a report, customizable by column, about the messages generated from an analysis. You can filter the displayed messages by selecting specific targets and rules in the configuration pane.

The properties pane contains two tabs. The Output tab displays informational, warning, and error messages when the TraceGeneral System.Diagnostics.TraceSwitch is enabled (the default) in the FxCop.exe.config configuration file. When a message is displayed in the Output tab, you can right-click in the pane to display a shortcut menu with the following choices:

  • Clear. This erases all information from the Output pane.

  • Copy Selected. Copies the selected information from the Output pane to the Clipboard.

  • Copy All. Copies all the information from the Output pane to the Clipboard.

The Properties tab displays detailed target, rule, or message information when an item is selected in the configuration or messages pane.