Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Number of Classes in a Visual Studio Solution

Is there an easy way to find the number of classes contained within a visual studio solution? Other than writing a funky find script, I couldn't find a way to do it within the code metrics piece of VS.

I am running Visual Studio 2008 and this is a VB.Net project through and through.

thanks!

like image 735
lyngbym Avatar asked Sep 18 '08 16:09

lyngbym


3 Answers

You could use a free tool like SourceMonitor, which has a reasonable set of metrics including number of classes. You could also use a tool like NDepend which is a lot more powerful, but also costs money. Either can be integrated into your build environment if you're using MSBuild or NAnt.

like image 93
scott.caligan Avatar answered Oct 12 '22 05:10

scott.caligan


Don't know a direct way but maybe this will help you:

  • Open MainMenu/View/Other Windows/Code Metric Results
  • Calculate Code Metrics Results
  • Export the Results to Excel
  • Use Excel to get the count of unique Types in the List.

Don't know if the Code Metrics Stuff is available in all Editions of VS. I'm using the Team Suite Edition.

like image 6
JRoppert Avatar answered Oct 12 '22 06:10

JRoppert


Open the solution and search in all files " class " (with the white space before and after the word class). This will find all lines like:
public class A : B
The result should be something like
Matching lines: 2887 Matching files: 2271 Total files searched: 2486
The first number is the one you are searching for.

like image 1
Velimir Avatar answered Oct 12 '22 06:10

Velimir