Ordering a project in Visual Studio

Does Visual Studio 2008 determine the order in which projects appear in the solution folder? This is not in alphabetical order, nor is the assembly order.

I cannot find a way to change the order in which the projects are listed. I tried deleting my .suo file as well as moving things to the .sln file. There was no effect.

How to change the display order of my projects?

+47
visual-studio projects-and-solutions order
Feb 11 2018-10-11
source share
5 answers

There is a feedback request already posted on Connect.Microsoft.com, so you have to wait for a permanent solution.

http://connect.microsoft.com/VisualStudio/feedback/details/468874/solution-explorer-project-sort-order (replaced by Wayback Machine link as original)

Temporary workarounds are available, but not good enough, I feel. One of them:

Press F2 to rename the project, then press Enter without changing the name. This temporarily sorts the projects inside this folder.

(according to http://social.msdn.microsoft.com/Forums/en-US/vssetup/thread/79d46a69-386e-4ad8-b9cb-b00d4252495b/?prof=required )

Or use http://solutionsorter.codeplex.com/ to change the SLN for permanent fix if your solution folders are not nested (he ate my solution)

But this will not work if you close and open the solution.

If you are using Resharper, you can press CTRL + N shortcut to find out the files in the solution and CTRL + F12 to find the methods in the file.

+8
Feb 11 2018-10-11
source share

Unfortunately, VS2010 makes projects sort alphabetically.

Perhaps renaming projects by adding a numerical prefix (01, 02, 03, etc.) to achieve the desired order is the only workaround, although not ideal.

+11
Apr 18 '12 at 5:40
source share

Take the .sln file in any text editor. Order Details
"Project (" {2150E333-8FDC-42A3-9474-1A3956D46DE8} ") =" etc. "

...
Endproject

in any order. Save it. All this. The next time you open this solution, the projects will be in THAT order.

+8
Feb 21 '11 at 18:23
source share

Alternative to hacks: copy the section with these lines into a text file.

Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "etc..." EndProject 

Use this F # script to sort alphabetically (changing the file path as needed):

 open System.IO let readlines p = File.ReadAllLines(p) let writelines p lines = File.WriteAllLines(p, lines) let startpos = @"Project(""{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}"") = """.Length let getProj (s:string) = s.Substring(startpos, s.IndexOf('"', startpos) - startpos) let path = @"C:\Temp\sln.txt" path |> readlines |> Array.filter (fun s -> s.StartsWith("Project")) |> Array.map (fun s -> (getProj(s), s)) |> Array.sortBy fst |> Array.map snd |> Array.collect (fun s -> [|s;"EndProject"|]) |> writelines path 

(If you have only a few projects, just collect them manually)

+4
Nov 08 '10 at 11:15
source share

For this solution: stack overflow

You can use Solution Folders to sort without worrying about it, influencing project dependencies. Not sure how well this works until 2013, but I came across this question in my search for 2013 and thought it could help others in my situation.

+2
Nov 22 '14 at 10:48
source share



All Articles