Visual Studio Solution Sorter

If you move Visual Studio projects into a solution folder, have you noticed that they often do not sort alphabetically? SolutionSorter is a tool that will fix the sorting of projects within your Visual Studio solution file.

How To Use

The application runs in three modes.

1) Pass in a command line parameter that contains the path to your solution (.sln) file. Example: SolutionSorter.exe "c:\filepath\mySolution.sln".
2) Copy the executable into the folder that contains your solution (.sln) file and run it in that folder. Note: if there are multiple .sln files in that folder, the application will use mode #3 below.
3) Open File Dialog for choosing the solution file to sort.

The application will create a copy of your solution file using the following naming convention:

OriginalSolution.sln becomes OriginalSolution.Sorted.sln

It is up to you to check that the new solution file works properly. Then you can replace your old .sln file with the new one with a simple file rename (backup first though!).

How It Works

It's simple, really. If you open your solution file in a text editor, you'll notice that the project reference sections have a GUID key, followed shortly by the Project name. By sorting the items in the projects section by the Guid Key, then by Project Name, Visual Studio will display projects in a solution folder in the proper Alphabetic sequence.

About

Solution Sorter was created by Jeff Doolittle, VP Technology for Lotpath, Inc. http://www.lotpath.com and CTO of SJV Technology Group, LLC http://www.sjvtech.com.

Future Versions

Ideas for future versions:
- set config parameter to automatically overwrite solution file instead of making a copy with "Sorted" in the file name (with command line params, or a configuration screen)
- create an installer for the application
- create a visual studio add-in

Warning

If you are working on a project with a team of developers, make sure everyone has checked in lately before sorting your solution file. Otherwise, you will have lots of merge conflict headaches.

Last edited Oct 28, 2009 at 12:04 AM by jeffdoolittle, version 10