How to automatic format code in Visual Studio

daowdos 261 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.

Visual Studio
Visual Studio
A family of Microsoft suites of integrated development tools for building applications for Windows, the web and mobile devices.
4,635 questions
C#
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.
10,299 questions
VB
VB
An object-oriented programming language developed by Microsoft that is implemented on the .NET Framework. Previously known as Visual Basic .NET.
2,580 questions
{count} votes

6 answers

Sort by: Most helpful
  1. Chandraprakash G 1 Reputation point
    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