How do you count the lines of code in a Visual Stu

2019-01-03 11:28发布

Is it possible to find the number of lines of code in an entire solution? I've heard of MZ-Tools, but is there an open source equivalent?

25条回答
成全新的幸福
2楼-- · 2019-01-03 11:38

Answers here are a little bit out of date, may be from vs 2008 time. Because in newer Visual Studio versions 2010/2012, this feature is already built-in. Thus there are no reason to use any extension or tools for it.

Feature to count lines of code - Calculate Metrics. With it you can calculate your metrics (LOC, Maintaince index, Cyclomatic index, Depth of inheritence) for each project or solution.

Just right click on solution or project in Solution Explorer,

enter image description here

and select "Calculate metrics"

enter image description here

Later data for analysis and aggregation could be imported to Excel. Also in Excel you can filter out generated classes, or other noise from your metrics. These metrics including Lines of code LOC could be gathered also during build process, and included in build report

查看更多
姐就是有狂的资本
3楼-- · 2019-01-03 11:41

Try neptuner. It also gives you stuff like spaces, tabs, Lines of comments in addition to LoC. http://neptuner.googlecode.com/files/neptuner_0_30_windows.zip

查看更多
SAY GOODBYE
4楼-- · 2019-01-03 11:42

You could use:

查看更多
不美不萌又怎样
5楼-- · 2019-01-03 11:42

Agree with Ali Parr. The WndTab Line Counter addin is a such tool. http://www.codeproject.com/KB/macros/linecount.aspx

It's also a good idea to search from download site to find some related tool. http://www.cnet.com/1770-5_1-0.html?query=code+counter&tag=srch

查看更多
祖国的老花朵
6楼-- · 2019-01-03 11:42

I came up with a quick and dirty powershell script for counting lines in a folder structure. It's not nearly as full featured as some of the other tools referenced in other answers, but I think it's good enough to provide a rough comparison of the size of code files relative to one another in a project or solution.

The script can be found here:

https://gist.github.com/1674457

查看更多
Animai°情兽
7楼-- · 2019-01-03 11:46

Found this tip: LOC with VS Find and replace

Not a plugin though if thats what you are looking for.

查看更多
登录 后发表回答