Is there a way to count lines of code in a project?

Does VS 2005 have some way to count the lines of code in a project? It's not any kind of vital statistic to me as much as I'm just curious.

8 Comments

  • I haven't tried this out, but here's a "Macro to count lines of code in .cs files" from GotDotNet...



    http://www.gotdotnet.com/Community/UserSamples/Details.aspx?SampleGuid=fb625d28-2c99-4066-a158-4b9cfe5ced98

  • Sorry for the double post, but here's probably a better way...



    http://www.codeproject.com/macro/linecount.asp

  • I have wanted the same feature and a while back I just wrote a little vbscript that will count the lines in various files.



    http://kylefinley.net/archive/2005/10/03/18.aspx



    This could easily be modified to be a macro. I only wanted it for curiosity sake on an old project.

  • If there's nothing that does what you want, you may want to put it up on Product Feedback as a suggestion too. I'd vote for it if you did. I've wanted something similar for a long, long time. Would be neat to see what percent of lines of code in my app I actually wrote myself and how much was generated code, etc

  • Check out the DPack addins -



    There's a stats view that includes totals as well as breakdowns by comment and code lines (and support for copying to clipboard):

    http://www.usysware.com/dpack/Stats.aspx



    It's free, and the VS2005 RTM version has been released.

  • Oh, and the DPack main page: http://www.usysware.com/DPack/Default.aspx

  • You can always do a regular expression search. Just enter the character . (full stop) in the search box to find all non empty lines. The count shows up in the Find Results window.

  • I recommend Source Monitor from http://www.campwoodsw.com/ .

Comments have been disabled for this content.