These are actually not direct answers, but they can help someone:
For many languages, you can enable automatic formatting as you type in Visual Studio (Tools> Options> Text Editor> {language}> Formatting), so it shouldn't be too hard to have the code in order before you can check.
You can also format the document on demand using Edit> Advanced> Document Format, so you can always do this immediately before checking (although you will have to reopen any pending changes)
As a rule, it’s pretty fast / easy to keep the code in order (especially with the above). If you hang yourself too much on “perfect” formatting, you will find that you spend a lot of time indenting and layout instead of doing useful work — and you will be annoyed by “broken” formatting when you return to the same code several times weeks later, just to find that what you thought was perfect still had some glitches in it or that your personal coding style deviated slightly. This behavior can even lead to a battle for style with others when you try to work in a team, which can become a serious destructive activity. Thus, there is value in learning when “good enough is enough” and do not waste energy trying to achieve perfection.
Finally, it would be very easy to write code that sat on the TFS event and handled all the checks to ensure the encoding layout style. But then again, if you feel that the amount of effort is required / justified, you are likely to have some fun in your text layout and can benefit from focusing more on writing good code that supports the code than on making it looked beautiful. The compiler doesn’t care, since the code is read to you and your team members, it is probably good enough.
source share