Is it possible to anyhow figure out how many lines of code there are in one solution using VS.NET? :rolleyes:
Printable View
Is it possible to anyhow figure out how many lines of code there are in one solution using VS.NET? :rolleyes:
Tools---Options----Text Editors--All Languages----General then near to the bottom , line numbers , tick it .
He wants to know in the whole project, not in a single file.
Well built in with VS.NET there isn't such thing but there are a couple (free) plugins that can do it. I already had here one but I dont have it anymore and I dont remember its name :rolleyes:
count the numbers of each file and you get the total of the lines in your project . Mr.Polite is damn lazy ....:D :p
Well if you have 10++ files it will be so boring
It's not that important anyways . Application never evaluated by the number of code lines but by the tech it's using . ;)Quote:
Originally posted by PT Exorcist
Well if you have 10++ files it will be so boring
I think it just doesn't matter. Mr Polite asked for a question and whatever the reasons he wants it for don't matter. He asked for the whole project and not for a single file..
I used to be interested in how many lines of code the app turns out to be, then after I started getting in the 10's of thousands, it just didn't matter anymore. Maybe it was because it was becoming a burden opening all my files, and counting them individually as mentioned above.
With that said, there are some really valuable reasons for knowing the total line count in a project. Lets say you finish writing an application, and you want to refactor it. Knowing the starting line count and the ending line count will help you justify to your boss that you were not just screwing off all day doing nothing.
If anyone finds one, I would be interested also. If not, maybe I will whip up a little app myself. This seems to be terribly simple to do. Look at the folder your app is in, cycle through the files one at a time doing a read line while incrementing a counter.... Add a few options in there, and bam, you got one.
62 files in this case:DQuote:
Originally posted by PT Exorcist
Well if you have 10++ files it will be so boring
umm I did write a program to do it, but you have to drag and drop all the files in it and it's just no convinient and plus doesnt work for C#:D so you think you can put some pressure on your brain cells and remember the plug-in that you used to use?:p
you can add a reference to the DTE object and count your lines in all forms ( also including the Assembly.vb ) , eg:
Note: this will select / highlight the text in each form / class , so you need to click in the form to deselect it , also you must have the project running at the time.VB Code:
'/// add a reference to the EnvDTE.dll ( version 7.0 ) '/// then in a button_click Dim ob As EnvDTE.DTE = Runtime.InteropServices.Marshal.GetActiveObject("VisualStudio.DTE.7.1") Dim doc As EnvDTE.Document Dim txt As EnvDTE.TextDocument For Each doc In ob.Documents If doc.Name.EndsWith(".vb") Then txt = doc.Object("TextDocument") txt.Selection.SelectAll() Dim selRange As EnvDTE.TextRanges = txt.Selection.TextRanges Console.WriteLine(doc.Name & " Contains : " & selRange.Count & " Lines of code") End If Next
hmm I didnt know you could do such things:D works but a little painful still hehe. What is the EnvDTE.dll btw? is it just for interacting with the VS.NET ide?Quote:
Originally posted by dynamic_sysop
you can add a reference to the DTE object and count your lines in all forms ( also including the Assembly.vb ) , eg:
Note: this will select / highlight the text in each form / class , so you need to click in the form to deselect it , also you must have the project running at the time.VB Code:
'/// add a reference to the EnvDTE.dll ( version 7.0 ) '/// then in a button_click Dim ob As EnvDTE.DTE = Runtime.InteropServices.Marshal.GetActiveObject("VisualStudio.DTE.7.1") Dim doc As EnvDTE.Document Dim txt As EnvDTE.TextDocument For Each doc In ob.Documents If doc.Name.EndsWith(".vb") Then txt = doc.Object("TextDocument") txt.Selection.SelectAll() Dim selRange As EnvDTE.TextRanges = txt.Selection.TextRanges Console.WriteLine(doc.Name & " Contains : " & selRange.Count & " Lines of code") End If Next
so anyone found an app for this yet? :rolleyes:
if you still need it.. try this:
http://www.nodesoft.com/VB.NetAnalyser/
EDIT:
oh.. using vb.net. nm then. :D
That's cool , but only for VB.NET ! :sick:Quote:
Originally posted by nahya^^
if you still need it.. try this:
http://www.nodesoft.com/VB.NetAnalyser/
EDIT:
oh.. using vb.net. nm then. :D
umm I think it worked with C# hmmQuote:
Originally posted by Pirate
That's cool , but only for VB.NET ! :sick:
edit: nm
Have some tool like "MZtools" on VB?
There is not a MZToolz yet for .Net only goes up to VB6 so far.
umm I wrote a little something that works with both C# and VB.NET...... have tested it with VS2003 files but should work with 2002 also (someone can be kind enough to test if you have vs2002).
http://vbforums.com/attachment.php?postid=1646986
tell me what you guys think? is it useful? It satisfies me hehe
Download file from below post:
download
It works good here on VS.NET 2003 . Tested on both VB.NET and C# projects . Good job MrPolite . :)
wow MrPolite. that's awesome.
thanks. :)
vb2003
:thumb: :thumb: Two Thumbs Up!!!:)
try this program out. It counts all the lines of code but not the comment lines or white space. Let me know what you think.
:D thanks heheheh
umm thephantom, its a good practice but I was tired of counting them one by one....
anyways it's a stupid app I wrote today after class, I'll post the code and the whole thing on another thread;)
umm let me know if I should change anything though
http://vbforums.com/showthread.php?threadid=282457