Wednesday, July 1, 2009

Using FxCop for Code Analysis the easy way

Scenario:
I keep looking for ways to provide tools to easily discover common issues so that automatically code can comply with best practice.

You can bing about Best Practice for Code Analysis and there is a utility which can help you to find some of the common problems. You can download it from here -- > Download MSI

Solution:
As I said tools should be easy to use , so here a small tip to make FxCop part of you every Visual Studio project.

FxCop

Steps:
1. Install FxCop 1.35 locally.
2. Open Visual Studio
3. Go to Tools > External Tools > Add a new tool with below settings

Setting:


Title : FxCopCmd

Path : C:\Program Files\Microsoft FxCop 1.35\FxCopCmd.exe ( This is default location where FxCop is installed, so if u have choose a different location while installing it, make sure to point it to right spot. )

Arguments : /c /searchgac /f:$(BinDir)$(TargetName)$(TargetExt)

Use Output Window : Checked
Now just go to Tools > FxCopCmd and you can see the report in your output window.

0 comments: