Microsoft have just released a new command line tool for computing the same code metrics that Visual Studio provides. These include Maintainability Index, Cyclomatic Complexity, Class Coupling, Depth of Inheritance, and Lines of Code. The tool is named Metrics.exe and can be downloaded here.
The results will be placed in an XML file whose schema matches the provided MetricsReport.xsd. Jakob Ehn has already documented how to integrate this with TFS 2010 Build. All that’s needed is an XSL file to integrate with CruiseControl.NET.
Thanks to Cameron Skinner for the announcement of the tool.
Update (1 Feb 2011): Please note that .NET Framework 4.0 is required for this tool. Also it requires version 10.0.0.0 of Microsoft.VisualStudio.CodeAnalysis.Common so you should have Visual Studio 2010 installed.
-Krip
[...] in CruiseControl.NET 1 February, 2011 Craig Sutherland Leave a comment Go to comments http://blog.kynetix.com/2011/01/31/computing-visual-studio-code-metrics-during-builds/ posted about how Microsoft has released a command-line version for generating static code metrics. [...]
Hi Krip
That’s an easy enough request – http://csut017.wordpress.com/2011/02/01/visual-studio-code-metrics-in-cruisecontrol-net/
Craig