visual-studio-2013

How to specify project filter order in visual studio?


Since the purpose of filters is to show the logical layout of a project where is this feature?

For some reason any top level filters always get stuck between my "Header Files" and "Source Files" Filters. Its not even in alphabetical order.

Note that I'm not interested in ordering my projects but rather the filters within my projects.

So how can I specify the order of my filters or at least sort them alphabetically?


Solution

  • In Visual Studio 2012 new filter is added in alphabetical order of it's default name. But later renames have no effect. Not very convenient, but we can get desired result:

    Workaround one:

    1. Before adding folder: add "a" to every folder name you want above to be above the new one. Add "zz_" to every folder you want to be bellow the new new one.

    2. Add your new folder.

    3. Rename all your folders back.

    It's tedious but still better than nothing.

    Workaround two: If you want to add multiple new folders, just add them in a row and rename later, so they are in desired order.

    Workaround three: Edit the project's XML directly might work too. But I personally prefer to not touch such a magic file.