计算有多少行代码包含 Visual Studio 解决方案

发布于 2024-09-27 18:09:20 字数 1539 浏览 0 评论 0原文

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

你在看孤独的风景 2024-10-04 18:09:20

打开搜索(ctrl+shift+f),

搜索解决方案中的所有文件(*.cs 或 *.vb),使用正则表达式^(行开头)。

等待。

PS。
您可以使用 ^.+$ 过滤掉空行(@ssc-hrep3 建议)

Open the search (ctrl+shift+f),

Search for all files in the solution (*.cs or *.vb), use regular expression ^ (line beginning).

Wait.

PS.
you can filter out empty lines with ^.+$ (a @ssc-hrep3 suggestion)

嘿哥们儿 2024-10-04 18:09:20

您还可以使用 DPack

DPack 是 Microsoft Visual Studio 2008/2010 工具的免费集合。 DPack 旨在大幅提高开发人员的工作效率、自动化重复流程并扩展 Microsoft Visual Studio 的一些功能。

DPack 非常方便,但您只能将其用于解决方案统计

解决方案统计功能允许评估整个解决方案的大小。它收集当前打开的解决方案中所有项目的信息。仅在代码文件上收集信息,包括:每个项目中的总行数、代码行总数、注释行总数和空行总数。
可以使用“导出”按钮将解决方案统计信息导出到逗号分隔的 CSV 文件。

You can also use DPack:

DPack is a FREE collection of Microsoft Visual Studio 2008/2010 tools. DPack is designed to greatly increase developer's productivity, automate repetitive processes and expand upon some of Microsoft Visual Studio features.

DPack is very handy but you can use it only for solution statistics:

Solution statistics feature allows one to evaluate the size of the entire solution. It collects information on all projects in the currently opened solution. The information is collected on code files only and includes: total number of lines, total number of code lines, total number of comment lines and total number of empty lines in each project.
Solution statistics can be exported to a comma delimited CSV file using Export button.

小巷里的女流氓 2024-10-04 18:09:20

使用 powershell 移动到包含项目文件的文件夹,然后输入命令,

(dir -r -include   *.cs,*.vb | select-string . ).count

将“cs”“vb”替换为要包含在计数中的文件扩展名。

Using powershell move to the folder containing your project files and enter the command

(dir -r -include   *.cs,*.vb | select-string . ).count

replace "cs" "vb" with file extensions you want to include in your count.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文