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 C#
{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 Answers by the question author, which helps users to know the answer solved the author's problem.