Monday, February 07, 2011

Code Metrics From The Command Line - Power Tools

In my last post I’ve talked about What is Code Metrics in Visual Studio, and how Code Metrics will allow you to monitor you code to find those un-maintainable and complex hotspots
“Microsoft just release a command line because many customers are looking for a way to generate code metrics information as part of their build process. In this way, the complexity associated with assemblies coming out of your nightly builds could potentially be tracked and examined over time, which is where I think information like this is most valuable.”

Usage
After the installation you can find metrics.exe in - C:\Program Files (x86)\Microsoft Visual Studio 10.0\Team Tools\Static Analysis Tools\FxCop

metrics.exe /f:FileName /out:ResultFile.xml
metrics.exe /f:*.dll /f:*.exe /out:ResultFile.xml

Example: Metrics.exe /f:metrics.exe /out:D:\MetricsResults\r.xml

Read more: Shai Raiten