Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
642 views
in Technique[技术] by (71.8m points)

visual-studio - 您如何计算Visual Studio解决方案中的代码行?(How do you count the lines of code in a Visual Studio solution?)

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?

(我听说过MZ-Tools ,但是有没有开源的?)

  ask by Fermin translate from so

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

I've found powershell useful for this.

(我发现powershell对此很有用。)

I consider LoC to be a pretty bogus metric anyway, so I don't believe anything more formal should be required.

(我认为LoC无论如何都是一个非常虚假的指标,所以我不相信任何更正式的要求。)

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.

(这将计算所有解决方案的.cs和.xaml文件中的非空行。)

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?

(为什么在单个命令行执行时会使用整个应用程序?)

:)

(:))


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...