How many lines of code do i have?

I am doing code reviews from time to time to my customers. When asking how lines of code do they have generally they do not know how to find it with an easy way.

Visual studio 2012 and 2010 has a cool feature called code metrics which you can use under analyze tab or just by right clicking the solution.


Code metrics results shows you how many lines of code do you have. Also this report has some useful info that may help you. The maintability index ratio is calculated by a formula using Cyclomatic Complexity and lines of code. Bigger ratio means easier maintability. There is also a color in front of it which means

Green   High Maintainability                       Between 20 and 100

Yellow   Moderate Maintainability             Between 10 and 20

Red        Low Maintainability                        Between 0 and 9

Cyclomatic complexity measures the structural complexity of the code. High number for cyclomatic complexity indicates that the code may be too complex, and should be refactored.

Depth of inheritance indicates the number of class definitions that extend to the root of the class hierarcy.

Class coupling indicates the total number of dependencies that a class has on other classes.

Comments (3)

  1. Larry Smith says:

    I gave it a shot and the results were useless for my web app. I got the message

    Message: One or more projects were skipped. Code metrics are available only for C#, Visual Basic, and C++/CLI projects that are not Web Site projects.

    I did get a few minor utility classes, but nothing overly useful.

Skip to main content