共用方式為


Analysis Reports

Analysis reports can be displayed or saved to an XML file. In either case, informational messages are displayed that show the progress of the analysis, such as rule assembly loading and engine initialization, in addition to any errors that are encountered. These messages can be suppressed by using two System.Diagnostics.BooleanSwitch switches in the FxCopCmd.exe.config file located in the FxCop installation directory. You can turn off the display of loading and initialization messages by changing the value of the WriteStandardOutput switch to 0. Similarly, you can suppress the display of any error messages by changing the value of the WriteStandardErrorOutput switch to 0.

When the /project option is specified, the output is based on the Save Messages settings for reports in the project file. The output is either a console or a report file. These settings determine which message states are included in the report. If no messages are included in the report, the output does not contain any messages, even if messages are generated in the FxCopCmd analysis. For information about how to change the Save Messages settings, see the "Setting Project Options" section of the Managing FxCop Projects topic.

When the /output option is used, the analysis report is saved to an XML file. The XML schema, FxCopReport.xsd, is located in the \Xml subdirectory installed by FxCop. This directory also contains XSL style sheets that transform the analysis report XML into formatted reports. By default, a style sheet processing instruction for the summary/detail report style sheet, FxCopReport.xsl, is automatically added to analysis reports. You can specify a different style sheet or disable this feature by changing the project settings by using the FxCop application. For more information, see the "Report Stylesheet and Apply Stylesheet" section in the Managing FxCop Projects topic.

If source code information is available for the programming element that caused a message to be generated, the analysis report includes the source code file and line number information for the element. FxCop looks for source code information in the program database (PDB) file for the assembly. This file must be located in the same directory as the corresponding assembly or in the location specified by the _NT_SYMBOL_PATH environmental variable. The C# and Visual Basic .NET compilers emit PDB information only for methods and properties; therefore, other programming elements that cause a message to be generated do not have this information.