TeamCity 7.0 Help

FxCop

The FxCop Build Runner is intended for inspecting .NET assemblies reporting possible design, localization, performance, and security improvements. If you want TeamCity to display FxCop reports, you can either configure corresponding build runner, or import XML reports by means of service messages, if you prefer to run the FxCop tool directly from the script. On this page you will find:

Please see Supported Platforms and Environments page for the supported FxCop versions list.

FxCop Settings

When a build agent is started, it detects automatically whether FxCop is installed. If FxCop is detected, TeamCity defines agent system property %\system.FxCopRoot% which is then used as a default value for the FxCop installation root parameter of the FxCopRunnerSettings. If you do not have FxCop installed on a build agent, you still can specify a path to FxCop executable (e.g. you can place FxCop tool to your source control, and check it out with a build sources). This path should be relative to the Build Checkout Directory.

Option

Description

FxCop installation root (mandatory parameter)

Specify the path to the FxCop installation root on an agent machine, or a path to the FxCop executable relative to the Build Checkout Directory. Default value set to "%\system.FxCopRoot%" means that FxCop is detected automatically on agent machine.

FxCop version

If you have several versions of FxCop installed on your build agents, it is recommended to enter here specific version of FxCop you want to use to run inspections in your build to avoid inconsistency. If you leave default value of the field ('Not Specified'), TeamCity will use any available agent with FxCop installed. In this case the version of FxCop used in one build may not be the same as the one used in previous build, thus the number of new problems found will be different from actual state.

FxCop Options

Option

Description

What to inspect

Check one of the following options to specify object to inspect (either particular assemblies or a project)

Assemblies

Enter paths, relative to the Build Checkout Directory and separated by spaces, to inspected assemblies (use ant-like wildcards to select files by mask). FxCop will use default settings to inspect them. Enter exclude wildcards to refine included assemblies list.

Project

Enter the path (relative to the Build Checkout Directory) to previously prepared FxCop project from FxCop GUI

Search referenced assemblies in GAC

Search assemblies, referenced by targets, in Global Assembly Cache

Search referenced assemblies in directories

Search assemblies, referenced by targets, in specified directories separated by spaces

Ignore generated code

New option introduced in FxCop 1.36. Speeds up inspection

Report XSLT file

The path to XSLT transformation file, relative to the Build Checkout Directory or absolute on agent machine. You can use path to detected FxCop on target machine (i.e. "%system.FxCopRoot%/Xml/FxCopReport.xsl"). When Report XSLT file option is set, the build runner will apply XSLT transform to FxCop XML output and display resulting HTML to a new tab "FxCop" on the build results page.

Additional FxCopCmd options

Additional options for calling FxCopCmd executable. All options entered in this field will be added to the beginning of command line parameters

Using Service Messages

If you prefer to call the FxCop tool directly from the script, not as a build runner, you can use the importData Build Script Interaction with TeamCity to import an xml file generated by FxCopCmd tool into TeamCity. In this case the FxCop tool results will appear in the Working with Build Results of the build results page.

The Build Script Interaction with TeamCity format is described below:

##teamcity[importData type='FxCop' path='<path to the xml file>']

Last modified: 20 April 2023