0% found this document useful (0 votes)
165 views5 pages

FxCop 1.35: .NET Code Analysis Guide

FxCop is a code analysis tool that checks .NET managed code assemblies for conformance to the Microsoft .NET Framework Design Guidelines. It uses reflection, MSIL parsing, and callgraph analysis to inspect assemblies for more than 200 defects in the following areas: - Library design - Localization -Naming conventions - Performance - Security FxCop includes both GUI and command line versions of the tool.

Uploaded by

Alex SoonNight
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
165 views5 pages

FxCop 1.35: .NET Code Analysis Guide

FxCop is a code analysis tool that checks .NET managed code assemblies for conformance to the Microsoft .NET Framework Design Guidelines. It uses reflection, MSIL parsing, and callgraph analysis to inspect assemblies for more than 200 defects in the following areas: - Library design - Localization -Naming conventions - Performance - Security FxCop includes both GUI and command line versions of the tool.

Uploaded by

Alex SoonNight
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
You are on page 1/ 5

Code analyse

with
FxCop 1.35
(http://www.gotdotnet.com/Team/FxCop/)

Prsentation
FxCop is a code analysis tool that checks .NET managed code assemblies for
conformance to the Microsoft .NET Framework Design Guidelines. It uses reflection, MSIL
parsing, and callgraph analysis to inspect assemblies for more than 200 defects in the
following areas:
Library design
Localization
Naming conventions
Performance
Security
FxCop includes both GUI and command line versions of the tool.
Download link: http://www.gotdotnet.com/Team/FxCop/FxCopInstall1.35.MSI
Note: You must have the .NET 2.0 Framework installed on your PC before installing and
using the application FxCop.

Main parameter from FxCop:


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.

/console or /c

/directory: <directory>

Specifies an additional directory to search for assembly


dependencies. FxCopCmd always searches the target
/d: <directory>
assembly directory and the current working directory.
Can appear multiple times.
Where <directory> is the name of
the directory to search for target Optional.
or

assembly dependencies.
/file: <file/directory>

Specifies the target assembly to analyze. If you specify a


directory, FxCopCmd attempts to analyze all files with
the .exe or .dll extension.
/f: <file/directory>
Can appear multiple times.
Name of an executable file or Required unless /project is present.
or

dynamic-link library (DLL)

Displays a summary of FxCopCmd options.


Other options that appear with /help are ignored.
Specifies the file name for the analysis report.
If the file exists, it is overwritten without warning. If no
/out: <file> or /o: <file>
items are reported by the analysis and the file does not
Where <file> is the name of the exist, it is not created. If the file exists, it is deleted.
By default, the file includes an xml-stylesheet processing
file for the analysis report.
instruction that references FxCopReport.xsl.
/help or /?

/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 to load.

/rule: <file/directory>
or
/r: <file/directory>

Specifies the location of rule libraries to load. If you


specify a directory, FxCopCmd attempts to load all files
the with the .dll extension.

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

/summary or /s
/types: <type list>
or
/t: <type list>
Where <type list> is a separated
list of type names to analyze.

Includes a summary report with 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.
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.

NAnt script for CruiseControl.net:


<?xml version="1.0"?>
<project name="FxCopReport" default="runFxCop" basedir=".">
<!-- Init Nant properties -->
<tstamp property="build.date" pattern="dd-MM-yyyy" verbose="true"/>
<sysinfo/>
<target name="runFxCop" description="Run FxCop">
<exec program="C:\Programme\Microsoft FxCop 1.35\FxCopCmd.exe"
failonerror="false">
<arg value="/f:bin\Debug\*.dll" />
<arg value="/f:bin\Debug\MySiasTest.exe" />
<!-- <arg value="/r: !!! You can use specific rules here !!! />
<arg value="/out:bin\FxCopResult.xml" />
</exec>
</target>

-->

</project>

To convert the XML file to an html report:


Open a command prompt and type the following command:
>XslTransform.exe /xsl:FxCopReport.xsl FxCopResult.xml /out:Report.html

Finally you have as result an html file that looks like this:

For more information, you can see a little tutorial (in French) at this address:
http://webman.developpez.com/articles/dotnet/fxcop/

You might also like