It has come to my attention that not everyone knows about or uses all of the development tools I know about and use. As such, I’m going to start a series of posts about development tools you should be using, starting with FxCop.
FxCop is a “static analysis” tool from Microsoft. Here’s how they describe it:
FxCop is an application that analyzes managed code assemblies (code that targets the .NET Framework common language runtime) and reports information about the assemblies, such as possible design, localization, performance, and security improvements.
Here’s what it looks like:
FxCop comes with a large suite of rules for evaluating software assemblies. To run it, compile your software, open FxCop, select a target (Project / Add Targets…), select the rules you want to include (Rules tab) and click Analyze (on the toolbar).
What you get is a list of all the places your code violated the selected rules (in the right hand pane) and details for each violation (in the lower pane). As you can see from the size of the position indicator in the scroll bar, running FxCop on the new WCF middleware interface (Symetra.Services.Middleware.dll) produced quite a few errors. (Yikes!) Looks like I’ve got my work cut out for me before I put that code to bed.
Static analysis tools like FxCop are typically run during an automated build process to ensure that all of the developers on a team are following sound development practices. As Microsoft mentioned (above) FxCop is specific to design, localization, performance and security. Another Microsoft tool called StyleCop can alert the team to violations of the team’s coding standards. But, that’s another post.
For now, I hope you found this post handy. Because, to paraphrase Red Green: “If the developers don’t find us architects handsome, they should at least find us handy.”
UPDATE: I thought of a few more things to point out this morning:
- Note that the FxCop bits can be found in AccuRev under the Lib\FxCop folder.
- I setup the WCF Middleware Service stream to “include” the latest FxCop bits from the stream entitled sym_Lib_FxCop_1.3.6.
- I checked-in .FxCop ruleset file in the same folder as the .sln file. I also added it to the solution in a solution folder, so it would be in my face – and I might remember to run FxCop locally before checking in my code.