Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

.NET Lines of Code Counter

Tags:

c#

.net

I was wondering if anyone could recommend a good LOC counter for .NET projects (web, windows service, etc.)? Some features that I'm looking for include:

  • Ability to export results to Excel or something similar (not just PDF as I may want to work with the data);
  • Create several counter projects (e.g. project 1 includes .NET projects A,B and C, and project 2 includes .NET projects D, E and F);
  • Be able to track changes to projects over time;
  • Easily weed out bogus files (like VSS files, csproj files, .user files, etc.);
  • Count code against TFS, VSS , file system;
  • Ideally, I'd like to be able to point the app to a .sln file and have it import all projects, instead of me having to add each project one by one;
  • Include JavaScript files (and ideally exclude comments, but that's a nice-to-have);
  • EDIT Freeware would be preferred but not a show-stopper;
  • EDIT Support for .NET 3.5 and 4 is required.

I saw a few older questions along the same line, but was hoping for some updated tools that support various types of .NET projects (not just web projects, for example).

Thanks in advance!

like image 343
David Hoerster Avatar asked Aug 31 '10 13:08

David Hoerster


2 Answers

Visual Studio 2008 and 2010 has a code analyzer built in. In the solution explorer right click on the project and pick Calculate Code Metrics. You can read more here http://blogs.msdn.com/b/habibh/archive/2009/10/27/how-to-count-the-lines-of-code-loc-in-your-application-using-visual-studio.aspx

Raul

like image 147
HaxElit Avatar answered Oct 05 '22 06:10

HaxElit


Would this project found on CodeProject do? - and has been updated for VS 2005/2008.

like image 26
t0mm13b Avatar answered Oct 05 '22 07:10

t0mm13b