Mark Lalor
Mark Lalor

Reputation: 7887

Change order of files in solution explorer

In Visual Studio, how do you change the order of your source files?

By default, it seems that they go in alphabetical order but I want to put them in a more logical order.

Upvotes: 16

Views: 6498

Answers (2)

tobi_s
tobi_s

Reputation: 1484

The usual solution would be to prefix the filenames with numbers. This is at least useful for folders, e.g. 00_comes_first, 01_externals, 01_tools, 99_last_of_the_important_folders would appear near the top before any files starting with letters.

Unfortunately, Microsoft broke this in recent releases of Visual Studio (17.6 and up) and now the numbered directories appear last unlike in every other piece of software (including the git changes view in VS). Feel free to upvote the corresponding bug report https://developercommunity.visualstudio.com/t/Ordering-in-Solution-Explorer-changed-n/10371646

Upvotes: 0

vcsjones
vcsjones

Reputation: 141638

You can't change the order that the Solution Explorer displays your files. If you need a more logical grouping, consider using folders and namespaces.

Upvotes: 14

Related Questions