[UPDATE 3/24/12] You can find a real code metrics activity here as part of the Community TFS Build Extensions.
Cameron Skinner has announced a new command line tool for generating code metrics. We’ve long gotten requests to be able to generate code metrics from the build. Prior to this tool, code metrics could only be generated from within the Visual Studio IDE.
I installed it this morning. The readme link on the download page tells you where it is installed, which is %programfiles%\Microsoft Visual Studio 10.0\Team Tools\Static Analysis Tools\FxCop.
I wanted to do the simplest possible thing (i.e., quick and dirty!) I could to give it a try this morning as part of a 2010 TFS build. I grabbed the copy of Professional Application Lifecycle Management I happened to have sitting here on my desk at home (thanks, Martin) and turned to page 504 to follow the ZIP archive example to get me started. You can get the entire build chapter for free (same with the manual testing chapter).
Then I checked in my build template changes and ran a build. The drop folder now contains a file called out.xml with the code metric data in it.
You can find documentation on all of the activities here on MSDN.
[UPDATE 1/30/10] Martin sent me the links to the build and testing chapters, which I’ve added above.