I have inherited a large source tree, C #, Visual Studio 2008.
It has many quality problems, one of which is that the code is usually poorly formatted.
I am looking for a tool, preferably a plug-in for Visual Studio, which will consider the whole solution and apply the same basic formatting as Visual Studio itself when, for example, you close curly braces around a block of code.
Any suggestions?
ok, so why not try the macro if you want to make the whole decision, there is an example vb here
http://blogs.msdn.com/kevinpilchbisson/archive/2004/05/17/133371.aspx
it opens each file and applies the same formatting as VS, but the macro will work throughout the solution (maybe it is not so reasonable to run it if your solution is huge), not counting the internal documents of the document format in VS and turning it into which this thread, this is apparently the easiest way to use what I find a very useful feature in visual studio
In vs2005, you can do Edit-> Advanced-> Format Document for a single file, which (I believe) will do what you ask. I guess vs2008 has a similar function somewhere.
ReSharper should do what you are looking for. Check out their code cleanup feature . This can be applied to several files, including the whole solution.
if you have already set your preferences in the vs editor options, you should press CTRL K, CTRL D, which will sort the code based on your settings
Here is an easy way (for me) ...
I have Visual Studio to reformat to "Paste"
Tools | Options | Text Editor | C# | Formatting **Automatically format on paste** (checked)
When I click the ugly file, I do CTRL-A, CTRL-X, CTRL-V-poof, instant format :)
Hope this helps.
Kevin