Command-Line Tool Options

The following table shows the options that are supported by FxCopCmd. Option values are not case sensitive.

Option Details

/applyoutXsl

or

/aXsl

Applies the XSL transformation that is specified in /outXsl to the analysis report before saving the file.

Cannot appear multiple times.

Optional.

/console

or

/c

Directs analysis output to the console or to the Output window in Visual Studio .NET. By default, the XSL file FxCopConsoleOutput.xsl is applied to the output before it is displayed. For more information, see Visual Studio Integration of FxCop.

Required unless /consoleXsl, /out, or /update is present.

/consoleXsl: <xsl>

or

/cXsl: <xsl>

where <xsl> is the name of the XSL file to use.

Specifies the XSL or XSLT file that contains a transformation to be applied to the analysis output before it is displayed in the console or the Output window of Visual Studio.

This option overrides the default XSL file applied to the analysis output.

Required unless /console, /out, or /update is present.

/directory: <directory>

or

/d: <directory>

where <directory> is the name of the directory to search for target assembly dependencies.

Specifies an additional directory to search for assembly dependencies. FxCopCmd always searches the target assembly directory and the current working directory.

Can appear multiple times.

Optional.

/file: <file/directory>

or

/f: <file/directory>

where <file/directory> is the name of an executable (.exe) file or DLL, or a directory to browse for target assemblies.

Specifies the target assembly to analyze. If you specify a directory, FxCopCmd tries to analyze all files that have the .exe or .dll extension.

Can appear multiple times.

Required unless /project is present.

/help

or

/?

Displays a summary of FxCopCmd options.

Other options that appear with /help are ignored.

/import: <file/directory>

or

/i: <file/directory>

where <file/directory> is the name of the FxCop report (.xml) or project (.FxCop) file to use, or a directory to browse for report or project files.

Specifies the name of an analysis report or project file to import. Any messages in the imported file that are marked as excluded are not included in the analysis results.

If you specify a directory, FxCopCmd tries to import all files that have the .xml extension. To import all FxCop project files instead, include *.FxCop.

If analysis results are saved to a project file by using the /update option, the imported messages are not saved.

Can appear multiple times.

Optional.

/out: <file>

or

/o: <file>

where <file> is the name of the file for the analysis report.

Specifies the file name for the analysis report. For more information, see Analysis Reports.

If the file exists, it is overwritten without warning. If no items are reported by the analysis and the file does not exist, it is not created. If the file exists, it is deleted.

By default, the file includes an xml-style sheet processing instruction that references FxCopReport.xsl. The file is saved in XML format unless /applyoutXsl is specified.

Cannot appear multiple times.

Required unless /console, /consoleXsl, or /update is present.

/outXsl: <xsl>

or

/oXsl: <xsl>

where <xsl> is the name of the XSL file that is referenced in the processing instruction.

Specifies the location of the version of Mscorlib.dll that was used when the target assemblies were built, if this version is not installed on the computer that is running FxCopCmd. Typically, this option does not have to be set.

Cannot appear multiple times.

Optional.

/project: <file>

or

/p: <file>

where <file> is the name of the FxCop project file (.FxCop) to use.

Specifies the file name of an FxCop project file.

Cannot appear multiple times.

Required unless /file and /rule are present.

/rule: <file/directory>

or

/r: <file/directory>

 

where <file/directory> is the name of a rule library (.dll) or a directory to browse for rule libraries.

Specifies the location of rule libraries to load. If you specify a directory, FxCopCmd tries to load all files that have the .dll extension.

Can appear multiple times.

Required unless /project is present.

/summary

or

/s

Includes a summary report that has the informational messages returned by FxCopCmd. The summary shows the number of items found, how many items were new, and the running time for the analysis.

Optional.

/types: <type list>

or

/t: <type list>

 

where <type list> is a comma-separated list of type names to analyze.

Specifies the types to analyze. This option disables analysis of assemblies, namespaces, and resources; only the specified types and their members are included in the analysis.

The elements of <type list> can use the wildcard character '*' at the end of the name to select multiple types.

Cannot appear multiple times.

Optional.

/update

or

/u

Saves the results of the analysis in the project file. This option is ignored if the /project option is not specified.

Optional.

/verbose

or

/v

Outputs verbose information during analysis.

Optional.

/rule: <file/directory>

or

/r: <file/directory>

 

where <file/directory> is the name of a rule library (.dll) or a directory to browse for rule libraries.

Specifies the location of rule libraries to load. If you specify a directory, FxCopCmd tries to load all files that have the .dll extension.

Can appear multiple times.

Required unless /project is present.

At minimum, you must specify either of the following:

  • The location of the analysis output, using the /console, /consoleXsl, or /out option, and one of the following:

    • A project that uses the /project option.

    • An assembly to analyze and a rules directory pair using the /file and /rule options.

-or-

  • A project that uses the /project option and the /update option.

Option arguments have the following characteristics:

  • They can contain wildcard characters. For example, you could specify the target assemblies by using a path in this form:

..\MyBuildDirectory\Bin\*.*

  • They can contain environment variables. For example, if you have the environment variable FXCOPRULEDIR defined, you could specify the rule libraries using a path that contains %FXCOPRULEDIR%.

  • Option arguments that contain spaces must be enclosed in quotation marks. This includes environment variables that refer to values that contain spaces. For example, if the environment variable FXCOPRULEDIR refers to C:\Program Files\Microsoft FxCop\Rules, the rule option is specified as /r:"%FXCOPRULEDIR%".

If the /file and /project options are both present, the assemblies specified by the /file option are loaded after the assemblies specified in the project file. If an attempt is made to load a duplicate assembly, FxCopCmd displays an error message that indicates that an assembly with an identical signature has already been loaded.

If the /rule and /project options are both present, the rule libraries specified by the /rule option are loaded after those specified by the /project option. If an attempt is made to load a duplicate rule library, FxCopCmd displays an error message that indicates that a rule library with an identical signature has already been loaded.