Visual studio code metrics

In this post I will show you how to generate code metrics on a solution/project in Visual Studio to get information such as cyclomatic complexity, maintainability index etc broken down to method level.

With the target solution open in Visual Studio 2015 on the main menu select Analyse -> Calculate code metrics.


On completions you will be presented in a screen similar to the screenshot below:


With this information you will be able to identify code smells. For more information on what this data means please read this msdn article.

Update: Cool article on Cyclomatic complexity by Iris Classon.