How to automatic format code in Visual Studio

daowdos 296 Reputation points
2021-09-13T16:20:33.473+00:00

I remember I had an automatic code formating right after I pressed ctrl+s.
Now I don't have that.

All I have is "Code Formatter" that makes a lot of commets which I don't need and when I remove those comments with "Clear Comments" it will remove my personal commets also.

131665-no-auto-format-vs.png

Will be super glad for help here.

Developer technologies | VB
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.
Developer technologies | C#
Developer technologies | C#
An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.
{count} votes

6 answers

Sort by: Most helpful
  1. Chandraprakash G 21 Reputation points
    2021-11-13T15:01:23.593+00:00

    Microsoft itself has an official extension for this called Productivity power tools

    VS2017 & VS2019:
    https://marketplace.visualstudio.com/items?itemName=VisualStudioPlatformTeam.ProductivityPowerPack2017

    VS2022:
    Yet to incorporate this formatting feature
    https://marketplace.visualstudio.com/items?itemName=VisualStudioPlatformTeam.ProductivityPowerPack2022

    149027-image.png

    0 comments No comments

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.