views:

147

answers:

4

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!

+4  A: 

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

tommieb75
I've used this one before; it works well.
Nathan Taylor
Any reason it wouldn't support VS2010? I haven't looked at it yet - just asking. Thanks!!
David Hoerster
+1  A: 

Source Monitor does much of what you are looking for. I don't believe it works against any version control systems, but can be accessed through scripts. It does not work with JavaScript. I've used it on a number of projects and been happy with it.

sbass
+4  A: 

I usually use NDepend for code analysis it does have LOC as one of the metrics and support quite a few of your requirements (such as point at .sln file). No build in support for Version control systems but it is supported by quite a few continious integration servers

Rune FS
Mind leaving a note explaining the downvote?
Rune FS
+1  A: 

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

HaxElit
This is not available on all versions of 2008/2010. Only premium and above
Matt Ellen