Code Metrics provide an easy way to measure quality parameters for your code. While this feature has a good application within VS IDE, most of the people look for automating it with their build scripts. To facilitate build integration Microsoft released a new command line tool for computing the same code metrics. 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.

For more information on this tool, here are few other blog posts for your reference:

http://blog.kynetix.com/2011/01/31/computing-visual-studio-code-metrics-during-builds/ 

http://blogs.msdn.com/b/camerons/archive/2011/01/28/code-metrics-from-the-command-line.aspx