If you have landed here searching how to switch off auto formatting of code files in Visual Studio, you are either a code purist who does not like the formatting the IDE is performing or you are like me editing a large auto-generated class file (due to unfortunate situations) and Visual studio hangs or crashes on you every time you do a small change.
The good news is there is an option in the IDE to switch feature off. Through out the generations of visual studio this option may have moved between sections, but fortunately been called the same. The flag you are looking for is
Tools > Options > Basic > Advanced > Editor Help Section > Pretty listing (reformatting)of code