Visualstudio-docs: Code metrics - command line alternative?

Created on 16 Aug 2018  Â·  5Comments  Â·  Source: MicrosoftDocs/visualstudio-docs

Is there a way to calculate these without having to interact or use Visual Studio, so that it can be automated or used somehow as part of a build CI?


Document details

⚠ Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.

doc-bug vs-ide-code-analysitech

Most helpful comment

@pjmagee For now, you will have to build and use the exe. Please upvote or comment on https://github.com/dotnet/roslyn-analyzers/issues/1756 so we can prioritize that work item. Tagging @jinujoseph as well.

All 5 comments

@mavasani Manish, do you know if code metrics can be obtained at the command line?

Yes, we added support for both the following:

  1. Metrics.exe tool to generate a metrics report file from command line
  2. Code metrics analyzer rules that flag warnings when your code metrics go above the configured or default threshold values.

Both the above work for all .Net projects (netframework, netcore, netstandard).
See the UPDATE sections in https://visualstudio.uservoice.com/forums/121579-visual-studio-ide/suggestions/33459643--netcore-code-metrics for details. @gewarren, we should probably update the docs accordingly.

Okay I see the project in Github now that does this, however it's internal and not published as a NuGet package :( I was hoping to somehow hook in to this using a custom .NET Core Built project that scans a selection of .NET projects with a dashboard. Will this become a NuGet package at some point or will I have to build and use the exe?

@pjmagee For now, you will have to build and use the exe. Please upvote or comment on https://github.com/dotnet/roslyn-analyzers/issues/1756 so we can prioritize that work item. Tagging @jinujoseph as well.

I added a section about calculating code metrics at the command line - https://docs.microsoft.com/en-us/visualstudio/code-quality/how-to-generate-code-metrics-data?view=vs-2017#command-line-code-metrics. Closing this issue.

Was this page helpful?
0 / 5 - 0 ratings