'Visual Studio 2022 turn off auto indenting

So i upgraded to VS 2022. and anytime i add a semicolon. the whole code block gets backtabbed. does anyone know how to turn this off? getting tired of hitting ctrl z repeatedly..

Before.

Before semicolon

After

enter image description here



Solution 1:[1]

  1. Go to VS2022 Tools - Options Menu
  2. Type indent in search
  3. Look for Indentation under formatting option which appears under

Text Editor - C# - Code Style - Formatting Indentation

check / uncheck boxes to see how your code will look and save when happy

Solution 2:[2]

After consolidating code blocks to one block on the razor page... this seems to have corrected the issue. the indenting I believe may have been caused by some bug where the indenting fails due to attempting to address other formatted code. this is not really a solid answer but i did find that moving things around prevented this from occuring and this was nothing to do with any indenting settings within the tools text editor options.

Solution 3:[3]

There is another option under Tools - Options

Text Editor - All Languages - Tabs.

Try to specify Tab size and indent size

Solution 4:[4]

I'm not sure if you ever found the correct answer to your question, but I was having the same problem, and reading the other two answers led me to figuring it out. The problem is with the adaptive formatting option being turned on. To turn it off, go to

Tools -> Options -> Text Editor -> Advanced

You should see enter image description here

Uncheck 'Use adaptive formatting'

Save, and restart Visual Studio

This should do the trick for you.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 dbCoder
Solution 2 Mitch Storrie
Solution 3 dbCoder
Solution 4 User