Share via

Visual Studio 2026 - How many lines of code in my solution ?

Dani_S 5,581 Reputation points
2025-12-25T15:58:01.09+00:00

Hi,

I have VS 2026, last update, professional.

1.How many lines of code in my solution ?

2.I have README.md files, how many lines inside it?

Thanks,

Developer technologies | Visual Studio | Other
Developer technologies | Visual Studio | Other

A family of Microsoft suites of integrated development tools for building applications for Windows, the web, mobile devices and many other platforms. Miscellaneous topics that do not fit into specific categories.

0 comments No comments

Answer accepted by question author
  1. Harry Vo (WICLOUD CORPORATION) 4,750 Reputation points Microsoft External Staff Moderator
    2025-12-26T04:01:29.0333333+00:00

    Hi @Dani_S ,

    1.How many lines of code in my solution ?

    Do you mean you want to count how many lines of code in every file inside of your solution? If so, you can follow this:

    1. In your solution, press Ctrl + Q and type Developer PowerShell to open it.
    2. Input this command:
    Get-ChildItem -Recurse -Include *.cs,*.js,*.ts,*.cpp,*.h |    
    	Get-Content |    
    	Measure-Object -Line
    

    You can add more file type that you want to count, the above example will count the file type .cs, .js, .ts, .cpp, .h. If you want to exclude folder like bin or obj, use this example:

    Get-ChildItem -Recurse -Include *.cs |    
    	Where-Object { $_.FullName -notmatch "\\bin\\|\\obj\\" } |    
    	Get-Content |    
    	Measure-Object -Line
    

    2.I have README.md files, how many lines inside it?

    You can open the file and scroll to the end of the file, the last line number will tell you how many lines.

    2 people found this answer helpful.

1 additional answer

Sort by: Most helpful
  1. Q&A Assist
    2025-12-25T15:58:08.1466667+00:00
    AI generated content. This question contains an answer created with AI from Q&A Assist. Learn more

    To find the number of lines of code in your solution using Visual Studio 2026, you can utilize the built-in code metrics feature. This feature allows you to analyze your code and provides metrics such as the number of lines of source code and executable code. You can access this feature from the Analyze menu by selecting Calculate Code Metrics for your solution or specific projects within it.

    As for the lines inside your README.md files, Visual Studio does not provide a built-in feature to count lines in markdown files directly. You may need to open the README.md file in a text editor or use a script to count the lines manually.


    References:

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.