Are there any tools for VS that allow developers to view code according to their style desires?
For instance, some developers like K&R style brackets while others like ANSI style.
The backing code file can be in whatever format it wants, but the viewed source needs to be in the developer style.
It can be done. You just have to set the indentation options in the Visual Studio options. Then when a developer loads a file, he can just select “Reformat File” from the Edit menu (I think it’s in one of the advanced sub-menus) or go to the bottom of the file, remove the ending brace, and re-add it. The file will automatically be reformatted.
That said, this is a really bad idea. If you’re using source control, then every time a developer checks out a file that was previously checked in by somebody who used a different formatting convention, that file is going to show as modified. So you’ll have the potential for a lot of spurious checkins, and even if you somehow avoid the spurious checkins you have the problem that a developer might change one line of code, but a diff is going to show LOTS of changes because of all the formatting changes.
That’s not the only problem. Let’s say that a tester reports an error and a stack trace that says an exception occurred on line 263 of some module. You have to be sure to get the latest code from the source repository and keep it in the format that it was last compiled in. Otherwise, line 263 where the error was probably won’t be line 263 in your editor.
Tell your developers to decide on ONE indentation style. Anything else is going to cause you no end of grief.
By the way, I gave this some serious thought a few years back and even wrote about it in Source Control and Formatting Standards. I thought it was a good idea provided I could build the tools to do the automatic conversion to canonical format. At the time, I didn’t take into account the “where is line 263” problem. That one’s a killer, and the tools to do the automatic conversion are no picnic, either. All in all, I decided that it’s much easier and more reliable to just settle on a single style. It takes only a few days to get accustomed to an unfamiliar style.