Results 1 to 23 of 23

Thread: does VS.NET count the total lines of code? [wrote my own]

  1. #1

    Thread Starter
    l33t! MrPolite's Avatar
    Join Date
    Sep 2001
    Posts
    4,428

    does VS.NET count the total lines of code? [wrote my own]

    Is it possible to anyhow figure out how many lines of code there are in one solution using VS.NET?
    Last edited by MrPolite; Mar 12th, 2004 at 04:40 PM.
    rate my posts if they help ya!
    Extract thumbnail without reading the whole image file: (C# - VB)
    Apply texture to bitmaps: (C# - VB)
    Extended console library: (VB)
    Save JPEG with a certain quality (image compression): (C# - VB )
    VB.NET to C# conversion tips!!

  2. #2
    Sleep mode
    Join Date
    Aug 2002
    Location
    RUH
    Posts
    8,083
    Tools---Options----Text Editors--All Languages----General then near to the bottom , line numbers , tick it .

  3. #3
    yay gay PT Exorcist's Avatar
    Join Date
    Apr 2002
    Location
    . . . my reason of shame
    Posts
    2,729
    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
    \m/\m/

  4. #4
    Sleep mode
    Join Date
    Aug 2002
    Location
    RUH
    Posts
    8,083
    count the numbers of each file and you get the total of the lines in your project . Mr.Polite is damn lazy ....

  5. #5
    yay gay PT Exorcist's Avatar
    Join Date
    Apr 2002
    Location
    . . . my reason of shame
    Posts
    2,729
    Well if you have 10++ files it will be so boring
    \m/\m/

  6. #6
    Sleep mode
    Join Date
    Aug 2002
    Location
    RUH
    Posts
    8,083
    Originally posted by PT Exorcist
    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 .

  7. #7
    yay gay PT Exorcist's Avatar
    Join Date
    Apr 2002
    Location
    . . . my reason of shame
    Posts
    2,729
    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..
    \m/\m/

  8. #8
    PowerPoster hellswraith's Avatar
    Join Date
    Jul 2002
    Location
    Washington St.
    Posts
    2,464
    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.

  9. #9

    Thread Starter
    l33t! MrPolite's Avatar
    Join Date
    Sep 2001
    Posts
    4,428
    Originally posted by PT Exorcist
    Well if you have 10++ files it will be so boring
    62 files in this case

    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# so you think you can put some pressure on your brain cells and remember the plug-in that you used to use?
    rate my posts if they help ya!
    Extract thumbnail without reading the whole image file: (C# - VB)
    Apply texture to bitmaps: (C# - VB)
    Extended console library: (VB)
    Save JPEG with a certain quality (image compression): (C# - VB )
    VB.NET to C# conversion tips!!

  10. #10
    Frenzied Member dynamic_sysop's Avatar
    Join Date
    Jun 2003
    Location
    Ashby, Leicestershire.
    Posts
    1,142
    you can add a reference to the DTE object and count your lines in all forms ( also including the Assembly.vb ) , eg:
    VB Code:
    1. '/// add a reference to the EnvDTE.dll ( version 7.0 )
    2. '/// then in a button_click
    3.         Dim ob As EnvDTE.DTE = Runtime.InteropServices.Marshal.GetActiveObject("VisualStudio.DTE.7.1")
    4.         Dim doc As EnvDTE.Document
    5.         Dim txt As EnvDTE.TextDocument
    6.  
    7.         For Each doc In ob.Documents
    8.             If doc.Name.EndsWith(".vb") Then
    9.                 txt = doc.Object("TextDocument")
    10.                 txt.Selection.SelectAll()
    11.                 Dim selRange As EnvDTE.TextRanges = txt.Selection.TextRanges
    12.  
    13.                 Console.WriteLine(doc.Name & " Contains : " & selRange.Count & " Lines of code")
    14.  
    15.             End If
    16.         Next
    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.
    ~
    if a post is resolved, please mark it as [Resolved]
    protected string get_Signature(){return Censored;}
    [vbcode][php] please use code tags when posting any code [/php][/vbcode]

  11. #11

    Thread Starter
    l33t! MrPolite's Avatar
    Join Date
    Sep 2001
    Posts
    4,428
    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:
    VB Code:
    1. '/// add a reference to the EnvDTE.dll ( version 7.0 )
    2. '/// then in a button_click
    3.         Dim ob As EnvDTE.DTE = Runtime.InteropServices.Marshal.GetActiveObject("VisualStudio.DTE.7.1")
    4.         Dim doc As EnvDTE.Document
    5.         Dim txt As EnvDTE.TextDocument
    6.  
    7.         For Each doc In ob.Documents
    8.             If doc.Name.EndsWith(".vb") Then
    9.                 txt = doc.Object("TextDocument")
    10.                 txt.Selection.SelectAll()
    11.                 Dim selRange As EnvDTE.TextRanges = txt.Selection.TextRanges
    12.  
    13.                 Console.WriteLine(doc.Name & " Contains : " & selRange.Count & " Lines of code")
    14.  
    15.             End If
    16.         Next
    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.
    hmm I didnt know you could do such things works but a little painful still hehe. What is the EnvDTE.dll btw? is it just for interacting with the VS.NET ide?


    so anyone found an app for this yet?
    rate my posts if they help ya!
    Extract thumbnail without reading the whole image file: (C# - VB)
    Apply texture to bitmaps: (C# - VB)
    Extended console library: (VB)
    Save JPEG with a certain quality (image compression): (C# - VB )
    VB.NET to C# conversion tips!!

  12. #12
    Addicted Member
    Join Date
    Oct 2002
    Posts
    210
    if you still need it.. try this:

    http://www.nodesoft.com/VB.NetAnalyser/

    EDIT:

    oh.. using vb.net. nm then.

  13. #13
    Sleep mode
    Join Date
    Aug 2002
    Location
    RUH
    Posts
    8,083
    Originally posted by nahya^^
    if you still need it.. try this:

    http://www.nodesoft.com/VB.NetAnalyser/
    EDIT:
    oh.. using vb.net. nm then.
    That's cool , but only for VB.NET !

  14. #14

    Thread Starter
    l33t! MrPolite's Avatar
    Join Date
    Sep 2001
    Posts
    4,428
    Originally posted by Pirate
    That's cool , but only for VB.NET !
    umm I think it worked with C# hmm

    edit: nm
    Last edited by MrPolite; Mar 12th, 2004 at 01:14 AM.
    rate my posts if they help ya!
    Extract thumbnail without reading the whole image file: (C# - VB)
    Apply texture to bitmaps: (C# - VB)
    Extended console library: (VB)
    Save JPEG with a certain quality (image compression): (C# - VB )
    VB.NET to C# conversion tips!!

  15. #15
    Hyperactive Member csar's Avatar
    Join Date
    Mar 2002
    Location
    Siam
    Posts
    288
    Have some tool like "MZtools" on VB?
    Don't leave it till tomorrow, Do It Now!
    5361726176757468204368616E63686F747361746869656E

  16. #16
    Lively Member
    Join Date
    Sep 2003
    Location
    USA
    Posts
    102
    There is not a MZToolz yet for .Net only goes up to VB6 so far.
    ===============
    Tek
    ===============

  17. #17

    Thread Starter
    l33t! MrPolite's Avatar
    Join Date
    Sep 2001
    Posts
    4,428
    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).



    tell me what you guys think? is it useful? It satisfies me hehe
    Download file from below post:
    Attached Images Attached Images  
    Last edited by MrPolite; Mar 13th, 2004 at 01:33 AM.
    rate my posts if they help ya!
    Extract thumbnail without reading the whole image file: (C# - VB)
    Apply texture to bitmaps: (C# - VB)
    Extended console library: (VB)
    Save JPEG with a certain quality (image compression): (C# - VB )
    VB.NET to C# conversion tips!!

  18. #18

    Thread Starter
    l33t! MrPolite's Avatar
    Join Date
    Sep 2001
    Posts
    4,428

    Download here

    download
    Attached Files Attached Files
    Last edited by MrPolite; Mar 16th, 2004 at 04:25 PM.
    rate my posts if they help ya!
    Extract thumbnail without reading the whole image file: (C# - VB)
    Apply texture to bitmaps: (C# - VB)
    Extended console library: (VB)
    Save JPEG with a certain quality (image compression): (C# - VB )
    VB.NET to C# conversion tips!!

  19. #19
    Sleep mode
    Join Date
    Aug 2002
    Location
    RUH
    Posts
    8,083
    It works good here on VS.NET 2003 . Tested on both VB.NET and C# projects . Good job MrPolite .

  20. #20
    Addicted Member
    Join Date
    Oct 2002
    Posts
    210
    wow MrPolite. that's awesome.
    thanks.

    vb2003
    [vbcode]
    Me.Hide()
    [/vbcode]

  21. #21
    Addicted Member Hole-In-One's Avatar
    Join Date
    Mar 2003
    Location
    Minnesota
    Posts
    195
    Two Thumbs Up!!!

  22. #22
    Frenzied Member
    Join Date
    Nov 2003
    Posts
    1,489
    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.
    Attached Files Attached Files

  23. #23

    Thread Starter
    l33t! MrPolite's Avatar
    Join Date
    Sep 2001
    Posts
    4,428
    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
    Last edited by MrPolite; Mar 13th, 2004 at 01:32 AM.
    rate my posts if they help ya!
    Extract thumbnail without reading the whole image file: (C# - VB)
    Apply texture to bitmaps: (C# - VB)
    Extended console library: (VB)
    Save JPEG with a certain quality (image compression): (C# - VB )
    VB.NET to C# conversion tips!!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width