Count Code Lines Number in Visual Studio [closed]

家住魔仙堡 提交于 2019-12-08 17:43:22

问题


One team will analyze our .NET project(solution) code, so, before, they asked about how many lines of code contains our project.

Is there some statistical data, some code metrics in VS 2010?


回答1:


Open the search (ctrl+shift+f),

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

Wait.




回答2:


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.




回答3:


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.




回答4:


Yes

Here is a tutorial: http://blogs.msdn.com/b/habibh/archive/2009/10/27/how-to-count-the-lines-of-code-loc-in-your-application-using-visual-studio.aspx

Or you can use a dedicated tools like this one: http://code.msdn.microsoft.com/LOCCounter



来源:https://stackoverflow.com/questions/3941444/count-code-lines-number-in-visual-studio

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!