How do you count the lines of code in a Visual Studio solution?
I've found powershell useful for this. I consider LoC to be a pretty bogus metric anyway, so I don't believe anything more formal should be required.
From a smallish solution's directory:
PS C:\Path> (gci -include *.cs,*.xaml -recurse | select-string .).Count
8396
PS C:\Path>
That will count the non-blank lines in all the solution's .cs and .xaml files. For a larger project, I just used a different extension list:
PS C:\Other> (gci -include *.cs,*.cpp,*.h,*.idl,*.asmx -recurse | select-string .).Count
909402
PS C:\Other>
Why use an entire app when a single command-line will do it? :)
Visual Studio has built-in code metrics, including lines of code:
Analyze → Calculate Code Metrics