Downloads
Update
An updated version of the line count utility described in an earlier article is now available. This now:
- Does basic C++ line counting of Visual Studio.NET projects and solutions, as well as C# and VB.NET as previously.
- Counts the total number of code files and displays them in the summary section.
- Allows the summary to be selected (by dragging over it) and copied to the clipboard with Ctrl-C.
Unfortunately for C++ projects I don’t think there’s an easy way of identifying auto-generated code, and hence the application will always return zero for code-generated lines for C++ projects.
Code Project
An abbreviated version of these articles is available on the Code Project.

Rich, the .zip file for the executable seems to be corrupted (source is OK).
Comment by David Brabant — July 10, 2007 @ 12:46 pm
David
It’s working fine for me. What problem are you seeing?
Comment by richnewman — July 10, 2007 @ 7:32 pm
Zip file is def corrupted.
Comment by Anonymous — August 2, 2007 @ 12:55 pm
Guys
I have rebuilt the executable and reposted the zip. I think it should be OK now.
Rich
Comment by richnewman — August 4, 2007 @ 4:29 pm
Thx This Works Great!
Comment by Johann Combrink — August 17, 2007 @ 9:56 am
Hi Rich,
I found this via the Code Project.
I’m trying to generate useful information about Lines of Code during the build process. I can’t tell from the articles if there is a command line option or a non-interactive (html/xml) output option. Have you considered using such?
Comment by Michael Croft — September 18, 2007 @ 9:52 pm
Hi!
Thank you for the great utility. When I am analysing a vb.net 2003 project, I get the following error message in FindCodeFilesAndAddToChildContainersList: Invalid character in xml.
The reason is, that a filename in my *.proj contains a german umlaut (Ü), which is not XML-conform. Do you know a quick workaround?
Thanks!
Tobias
Comment by Tobias Schittkowski — October 16, 2007 @ 7:50 am
Great little utility, just what i was looking for. cheers.
Comment by Tom — November 21, 2007 @ 11:30 pm
Hi Rich,
Thanks for a great tool. I have one question, I tried it on a web service project (2005) and it did not pick up the program files in the app_code folder. Is there a setting that I can make to have it do that?
Thanks,
John
Comment by John Hosier — March 3, 2008 @ 5:03 pm
You rock.
Thanks,
Stephen and Andy
Comment by RabidWoo — March 26, 2008 @ 2:46 am
Wow,
Much thanks for the software.
Any chance of adding a print to screen option? so i could save it as a picture (jpeg, gif, bmp, etc)?
Much thanks anyway
Tzach
Comment by Tzach Solomon — June 9, 2008 @ 10:53 pm
This tool is very useful for my MSE project
Thanks a lot
Comment by Aghsan — June 19, 2008 @ 1:25 am
Very helpfull ! Thanx a lot!!!!
Comment by Alex. Tz. — June 28, 2008 @ 12:02 pm
Hi,
I found your application extremely useful. I made a couple of modifications to it if you are interested.
We use a lot of codeSmith templates in our projects so I wanted to to take the templates, and generated code into consideration. I also wanted to process .dbp prjoject (database projects).
I modified the code to handle .dbp, .sql, and .cst (code smith template) files and it seems to work fine. I had to modify the dataset, add some counters, etc. I also updated it to 3.5 of the framework and use some Linq stuff for array processing and the like.
If you are interested in the changes let me know and I can zip and get them to you.
Thanks again for this head start, your code was easy to read and modify and was a pleasure to work with.
Thanks,
Jeff
Comment by Jeff Marino — August 6, 2008 @ 7:37 pm
Nice Tool.Found your tool after a long search in web
Comment by Anonymous — September 2, 2008 @ 8:06 am
I was looking for a way to count lines in a large web application that I developed at work, and found this. It didn’t quite work for me out of the box (.NET Web Projects don’t have project files so this utility only found and counted my Helpers code, which is compiled in it’s own proj file to a DLL). However with the great documentation and design of the application I was able to modify the project in about an hour to do exactly what I wanted.
Thanks for the great utility, and for making it open-source so I could make it work for me too!
PS: If you want the code to make it work with Web Projects shoot me an email, I’d be happy to send it over. I did it with very minor changes to the CodeContainer and Factory classes and adding some items to the interface, all of which were needed to allow the utility to count based on Directory and added a class (called WebProject) which inherits and implements CodeContainer.
Comment by Ryan A — September 2, 2008 @ 6:26 pm
[...] Oh ya, tool Line Counter buatan mas Rich Newman ini bisa di-download disini. [...]
Pingback by 4,828 baris kode, Win32, dan pelajaran tentang Multi-Threading di Single-Threaded Apartment (STA) - Z & his Startup — September 27, 2008 @ 8:21 am
thnx for this great tool… if you just want to use it for counting lines etc. it is even better then code metric in vs.
Comment by jayan — October 7, 2008 @ 6:38 am
A suggestion would be to show the raw C# line count, this is what I neeed.
Comment by Glenn — December 4, 2008 @ 5:27 pm
Thanks for the tool. It works well. Curious, why is it so big (>60MB)?
Comment by Steve — January 17, 2009 @ 5:55 pm
Thanks! Very quick and useful.
Comment by Mark Stahler — February 2, 2009 @ 5:09 am
Thanks! This is quite useful.
One great feature would be the ability to export the data generated to various formats – e.g., .xls, .html, etc.
Comment by Anonymous — February 8, 2009 @ 7:28 am
Thanks.
Comment by Jef Claes — May 13, 2009 @ 10:46 am
Great work Rich! Really helped me.
Comment by Fariha Akhtar — May 14, 2009 @ 8:46 am