<p>I am looking for a (preferably) command-line tool that can reformat the C# source code on a directory tree. Ideally, I should be able to customize the formatting. Bonus points if the tool can be run on <a href="https://en.wikipedia.org/wiki/Mono_%28software%29" rel="nofollow noreferrer">Mono</a> (or Linux).</p>

[{'answer_id': 27271, 'author': 'Dana the Sane', 'author_id': 2567, 'author_profile': 'https://Stackoverflow.com/users/2567', 'pm_score': 2, 'selected': False, 'text': '<p>You could give <a href="http://astyle.sourceforge.net/" rel="nofollow noreferrer">Artistic Style</a> a try. It requires <a href="https://en.wikipedia.org/wiki/Perl" rel="nofollow noreferrer">Perl</a> to be installed though.</p>\n\n<p>It\'s got a decent list of formatting options, and supports C and Java as well.</p>\n'}, {'answer_id': 27272, 'author': 'Lucas Wilson-Richter', 'author_id': 1157, 'author_profile': 'https://Stackoverflow.com/users/1157', 'pm_score': 2, 'selected': False, 'text': '<p>This isn\'t command-line, Mono or Linux, but it\'s something: I\'ve been using <a href="http://www.jetbrains.com/resharper/" rel="nofollow noreferrer">ReSharper</a> (made by JetBrains) and it\'s rather good. It\'s a Visual Studio plugin, so I\'m guessing it\'s not your cup of tea.</p>\n'}, {'answer_id': 27301, 'author': 'jmatthias', 'author_id': 2768, 'author_profile': 'https://Stackoverflow.com/users/2768', 'pm_score': 1, 'selected': False, 'text': '<p>Take a look at <a href="http://www.polystyle.com/" rel="nofollow noreferrer">Polystyle</a></p>\n'}, {'answer_id': 29224, 'author': 'Joel Lucsy', 'author_id': 645, 'author_profile': 'https://Stackoverflow.com/users/645', 'pm_score': 0, 'selected': False, 'text': '<p>For completeness, check out <a href="http://uncrustify.sourceforge.net/" rel="nofollow noreferrer">http://uncrustify.sourceforge.net/</a></p>\n'}, {'answer_id': 150747, 'author': 'Community', 'author_id': -1, 'author_profile': 'https://Stackoverflow.com/users/-1', 'pm_score': 0, 'selected': False, 'text': '<p>Check out astyle. I am sure the KDE guys use it, but the website said that it supports C#. </p>\n'}, {'answer_id': 418595, 'author': 'James Nies', 'author_id': 50304, 'author_profile': 'https://Stackoverflow.com/users/50304', 'pm_score': 4, 'selected': True, 'text': '<p>You could also try <a href="http://www.narrange.net" rel="nofollow noreferrer">NArrange</a> to reformat your code.  The formatting options it supports are still pretty limited, but it can process an entire directory and is a command-line tool. Also, NArrange runs under Mono.</p>\n'}, {'answer_id': 2686023, 'author': 'rboarman', 'author_id': 131818, 'author_profile': 'https://Stackoverflow.com/users/131818', 'pm_score': 0, 'selected': False, 'text': "<p>I am going to second the ReSharper suggestion. I can't live without it.</p>\n\n<p>The built-in reformatting is under ReSharper &rarr; <em>Tools</em> &rarr; <em>Cleanup Code</em> menu and is bound to <kbd>Ctrl</kbd> + <kbd>E</kbd>, <kbd>Ctrl</kbd> + <kbd>C</kbd> by default.</p>\n"}, {'answer_id': 2797467, 'author': 'Cheeso', 'author_id': 48082, 'author_profile': 'https://Stackoverflow.com/users/48082', 'pm_score': 1, 'selected': False, 'text': '<p>I use <a href="https://en.wikipedia.org/wiki/Emacs" rel="nofollow noreferrer">Emacs</a> and <a href="https://code.google.com/archive/p/csharpmode" rel="nofollow noreferrer">csharp-mode</a>. One keystroke and the module is reformatted according to my desires.</p>\n\n<p>Before:</p>\n\n<p><a href="https://i.stack.imgur.com/CdK4y.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/CdK4y.png" alt="Alt text"></a>\n</p>\n\n<p>After:</p>\n\n<p><a href="https://i.stack.imgur.com/0CpwV.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/0CpwV.png" alt="Alt text"></a>\n</p>\n'}, {'answer_id': 3202515, 'author': 'Ira Baxter', 'author_id': 120163, 'author_profile': 'https://Stackoverflow.com/users/120163', 'pm_score': 1, 'selected': False, 'text': '<p>See our <a href="http://www.semanticdesigns.com/Products/Formatters/CSharpFormatter.html" rel="nofollow noreferrer">SD C# Formatter</a>.  Uses a full C# parser and prettyprinter; it will not break your code.</p>\n\n<p>EDIT: September, 2013:  Now runs on Windows and Linux.  Covers C# v5.</p>\n'}, {'answer_id': 18946222, 'author': 'NinjaCross', 'author_id': 203370, 'author_profile': 'https://Stackoverflow.com/users/203370', 'pm_score': 0, 'selected': False, 'text': '<p>Maybe you could take a look at <a href="http://visualstudiogallery.msdn.microsoft.com/0c5664a7-a723-4ac1-9932-d840dfafd6d5" rel="nofollow">this free Addin</a> for Visual Studio 2010/2012 i recently wrote :)</p>\n'}]
['https://Stackoverflow.com/questions/27253', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/2680/']