1

Is it possible to calculate the same code metrics as you get running "Analyze -> Calculate Code Metrics -> On Solution" from MsBuild compilation?

Ideally we would like to get the results on an Excel file (like when you execute "Export to Excel" from the "Code Metrics Result" window) but we could work with other options.

I have been checking the "Code Metrics PowerTool for Visual Studio 2015" but it does not fulfill our requirements as it works on IL (not source code) and you need to indicate an exe and we have several ones.

We have Visual Studio available in the build machine so we can automate it if needed.

Ignacio Soler Garcia
  • 21,122
  • 31
  • 128
  • 207

1 Answers1

1

Calculate solution code metrics with MSBuild 2015

It seems that almost all of the extension methods are dependent on the Code Metrics PowerTool after Microsoft provided this tool to us. And it works well as expected.

but it does not fulfill our requirements as it works on IL (not source code) and you need to indicate an exe and we have several ones.

If I understand your correctly, you want to calculate solution code metrics automatically, like manual options: "Analyze -> Calculate Code Metrics -> On Solution"? If yes, TFS should be a good recommendation. For the detail info, you can refer to Build Customization in Visual Studio 2015 & TFS 2015 using Code Metrics Utility.

Leo Liu
  • 71,098
  • 10
  • 114
  • 135
  • The link added explains how to use Metrics.exe on a binary so it is not valid in our context and it is not the same as "Analyze -> Calculate Code Metrics -> On Solution" – Ignacio Soler Garcia Jun 19 '17 at 07:26