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: