Possible Duplicate:
How do you count the lines of code in a Visual Studio solution?
How can I show the code metrics window in Visual Studio 2008 Professional SP1? I'm looking to see how many total lines of code my project is for school and I can't find it.
The help file said to go to View->Other Windows->Code Metrics, but this option is not available to me. I also tried right-clicking the project in the Solution Explorer to see if there was an option but there wasn't.
Where is this mythical unicorn of a feature? If the Pro version doesn't have this feature has anyone found a simple external method to count the lines in all .cs files in an automated way?
In VS2010 there is a in-built tool that counts all lines of code and other values too: Go to View -> Other Windows -> Code metrics results.
We can check all of the lines of code in a file or directory by the command cloc --by-file. Our folder contains two Vue files, so we're getting the count of both of them as well as the sum. Now, the most useful cloc command is to get the lines of code of the whole project.
By enabling . NET code-quality analyzers and enabling the four code metrics (maintainability) rules it contains. By choosing the Analyze > Calculate Code Metrics menu command within Visual Studio. From the command line for C# and Visual Basic projects.
You don't need 3rd party tools, just press CTRL+SHIFT+F, and in the window that pops up choose "use regular expression". Use this Regular Expression:
^:b*[^:b#/]+.*$
For Visual Studio 2012 and above the regular expression is:
^(?([^\r\n])\s)*[^\s+?/]+[^\n]*$
Code Metrics is only available in the Team System versions of Visual Studio 2008. If you have an Express Edition, Standard, or Professional you're out of luck.
See comments and screenshots here:
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With