views:

646

answers:

4

After reading Just say No! to C# Regions I'd like to find a Visual Studio 2008 add-in that will reorder my class members (constructors, properties, fields, methods, etc) in a consistent manner.

I know Resharper can do this, but are there any free tools?

+3  A: 

How about NArrange.

The only glitch is that it runs as a command line tool at the moment - but you can set up links in the "External Tools" section of VS, along the lines of:

  • Title: nArrange File
    • Command: [PathToNArrange]\bin\narrange-console.exe
    • Arguments: $(ItemFileName)$(ItemExt) /b /c:"[PathToNArrange]\yourconfig.xml"
    • Initial directory: $(ItemDir)
    • Tick “Use Output window” property
  • Title: nArrange File Restore
    • Command: [PathToNArrange]\bin\narrange-console.exe
    • Arguments: $(ItemFileName)$(ItemExt) /r
    • Initial directory: $(ItemDir)
    • Tick “Use Output window” property
Marc Gravell
+1  A: 

I haven't tried them, but maybe they'll help:

Igor Brejc
I tested SortCode on 2008 and it seems to work
Sam Saffron
A: 

Reginerate can do this for you and has a very customizable template:

http://www.rauchy.net/regionerate/

Martin Brown
The thing with Regionerate is that it actually creates Regions for all the different parts of code. Which still is pretty nifty, but sort of goes against the 'Say NO to C# Regions' statement.
Ruben Steins
+1  A: 

I just made a tool that can do this. It's free and it's open source. I use it daily and can't code without it.

SharpSort is plugin for VS that makes it easier Visual Studio 2005/2008/2010 developers to maintain their code clean and readable at all times by grouping and sorting source code members. You can also define your own custom code layout or use predefined ones.

http://sharpsort.codeplex.com

axiom