TeamCity On-Premises 2020.2 Help


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

For the list of supported FxCop versions, see Supported Platforms and Environments.

FxCop Build Runner Settings

FxCop Installation



FxCop detection mode

When a build agent is started, it detects automatically whether FxCop is installed. If FxCop is detected, TeamCity defines the %system.FxCopRoot% agent system property. You can also use a custom installation of FxCop or the use FxCop checked in your version control. Depending on the selection, the settings displayed below will vary.

Autodetect installation

Select to use the FxCop installation on an agent.

FxCop version

The option is available when is selected. Select one of the options from the dropdown. If you have several versions of FxCop installed on your build agents, it is recommended to select here a specific version of FxCop you want to use to run inspections in your build to avoid inconsistency. As a result, an agent requirement will be created. If you leave the default value of the field ('Any Detected'), 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 the previous build, thus the number of new problems found will be different from the actual state.

Specify installation root

Select to use a custom installation of FxCop (not the autodetected one), or if you do not have FxCop installed on the build agent (for example, you can place the FxCop tool in your source control, and check it out with the build sources).

Installation root

The option is available when is selected. Enter the path to the FxCop installation root on the agent machine or the path to an FxCop executable relative to the Build Checkout Directory.

What to inspect




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

Note that there is a limitation to the maximum number of assemblies that can be specified here due to command-line string limitation.

FxCop project file

Enter the path relative to the Build Checkout Directory to an FxCop project.

FxCop Options



Search referenced assemblies in GAC

Search the assemblies referenced by targets in Global Assembly Cache.

Search referenced assemblies in directories

Search the assemblies referenced by targets in the specified directories separated by spaces.

Ignore generated code

A new option introduced in FxCop 1.36. Speeds up inspection.

Report XSLT file

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

Additional FxCopCmd options

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

Build failure conditions

Check the box to fail a build on the specified analysis errors. Click build failure condition to define the number of the errors.

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 service messages to import an XML file generated by the FxCopCmd tool into TeamCity. In this case the FxCop tool results will appear in the Code Inspection tab of the Build Results page.

The service message format is described below:

##teamcity[importData type='FxCop' path='<path_to_the_xml_file>']
Last modified: 05 March 2021