Is there any tool to reformat C # code?

I am looking for (preferably) a command line tool that can reformat the C # source code in a directory tree. Ideally, I should be able to customize the formatting. Bonus points if the tool can be run on mono (or linux).

+11
code-formatting c #
Aug 26 '08 at 2:04
source share
10 answers

I came across this a bit late ... You can also try NArrange to reformat your code. The formatting options that it supports are still quite limited, but it can handle the entire directory and is a command-line tool. In addition, NArrange runs under Mono.

+6
Jan 06 '09 at 23:21
source share

You can give Artistic Style a try, perl is required to do this. He got a decent list of formatting options and also supports C and Java.

+4
Aug 26 '08 at 2:15
source share

This is not a command line, mono or linux, but it is something: I used ReSharper (made by JetBrains) and that is pretty good. This is a Visual Studio plugin, so I assume this is not your cup of tea, but hopefully someone comes along with a better answer :)

+3
Aug 26 '08 at 2:16
source share

Take a look at Polystyle

+1
Aug 26 '08 at 2:39
source share

I use emacs and csharp-mode . One keystroke and the module is reformatted according to my wishes.

before:
alt text

after:
alt text

+1
May 09 '10 at 11:23
source share

See our SD C # Formatter . Uses the full C # parser and prettyprinter; it will not break your code.

EDIT: September 2013: Now runs on Windows and Linux. C # v5 covers.

+1
Jul 08 '10 at 10:05
source share

Check out http://uncrustify.sourceforge.net/ for completeness.

0
Aug 26 '08 at 23:55
source share

Check astil. I'm sure the KDE guys use it, but the site said it supports C #.

0
Sep 29 '08 at 21:23
source share

I know this is an old post, but I'm going to repeat the ReSharper sentence anyway. I can’t live without him.

The built-in reformatting is located in the menu ReSharper-> Tools-> Cleanup Code and by default it is bound to Ctrl-E Ctrl-C.

0
Apr 21 '10 at 19:37
source share

Perhaps you can take a look at this free Addin for Visual Studio 2010/2012, which I recently wrote :)

0
Sep 22 '13 at 16:44
source share



All Articles