FxCop – Part I (Introduction)
This will be a series of articles on FxCop, which explains from the basics to advanced usage of FxCop. This article is the first of them which gives an introduction to FxCop.
Definition
It is a code analysis tool which analyzes the code and gives suggestions to improve coding.
Overview
It analyzes programming elements in targets, and provides an informational report that contains messages about the targets;
It can analyze either a dll or an exe.
Target
They are nothing but managed assemblies.
Message
Messages include suggestions about how to improve the source code used to generate them.
Rule
A rule is a code which analyses and finds defects and informs about it.
For analysis 2 things are required,
1. Target assemblies
2. Rules
Running FxCop
· From GUI
After installation, you will have shortcut in Programs menu; you can start FxCop by clicking the link.
· Command Line
You can run FxCop.exe with respective command line arguments to start it from command line.
Using FxCop you can do the following:
· Manage Rules (decide which rules need to be applied to which assembly)
· Apply Styles to Reports.
· Filter and save messages.
· And also you can save and reuse application settings.
Download Link
www.microsoft.com/Downloads/details.aspx?FamilyID=9aeaa970-f281-4fb0-aba1-d59d7ed09772&displaylang=en
Similar Code Analysis tools:
StyleCop is another tool which does code analysis.
Difference between FxCop and StyleCop:
FxCop does code analysis over the binaries, whereas StyleCop does code analysis over the source code itself.
Latest Versions:
FxCop : ver. 1.36
StyleCop : ver. 4.3.1.3
Steps to do an analysis:
1. Run FxCop.
2. File > New Project.
3. Project > Add Targets.
4. Select the desired assembly you want to analyze(it can either be a dll or an exe).
5. If you have selected multiple assemblies then select any one of them ( the one you want to analyze first) and then click Project > Analyze or press F5.
6. Then it will display list of messages in the right pane.
Subscribe to:
Post Comments (Atom)
0 comments
Post a Comment