Reputation: 9407
After migrating from VS 2015 to VS 2019, filters for Solution Explorer do not work anymore. Why?
In VS 2015, and in order to categorize files in the Solution Explorer without creating physical folders, I have .filters
file for each project. Filters show same-type files in a sorted order in the Solution Explorer (on a per-folder basis: Headers, Source, Debug ... etc). Right now, it is not working. And if I do Add->Existing for each project, and choose the respective filter for the selected project, I see no difference (even after unloading/loading, closing/opening VS.. etc)
I went through the filters file and made sure that nothing is wrong with them and all project's file are actually list. Any one can help?
VS 2015:
VS 2019:
Upvotes: 5
Views: 6070
Reputation: 11
Had the same problem. The resolution was to open the .vcxproj.user file delete the true reload visual studio - problem solved.
Upvotes: 1
Reputation: 1
In my case the filter file was saved like .filters instead of .vcxproj.filters .
Probably due to manual files mangling something went wrong and VS2019 did not imported correctly this file anymore.
My solution was to create a new filter "test" and replacing the .filters content into the new file.
Upvotes: 0
Reputation: 343
Had the same problem, try adding a new filter and move some files to that new filter. Close the VS while saving the ".filter" file, and re-open the VS, it retrieves the old filters. Now you can sort back your files.
Upvotes: 1
Reputation: 767
My .filters file had an error in it that was introduced during a merge. I compared the before and after and spotted a tag that no longer had a closing tag. After I add the closing tag I was able to open the project and my filters returned.
So if there's an error in the xml structure the filters stop working.
Upvotes: 1
Reputation: 318
Upvotes: 9
Reputation: 138
I had the problem like this and was playing with .filters file to understand what's srong. So after some time I've found that file include tags should be sorted according to folders! So for examle, if you have such a structure:
/folder
/sub1
/sub2
Your file should look like:
<ClInclude Include="folder1\file1.h">
<Filter>folder</Filter>
</ClInclude>
<ClInclude Include="folder1\sub1\file2.h">
<Filter>folder\sub1</Filter>
</ClInclude>
<ClInclude Include="folder1\sub2\file3.h">
<Filter>folder\sub2</Filter>
</ClInclude>
In my case the sorting was not correct and in Visual Studio IDE I was getting flat list of project files. I had something like this:
<ClInclude Include="folder1\sub1\file2.h">
<Filter>folder\sub1</Filter>
</ClInclude>
<ClInclude Include="folder1\sub2\file3.h">
<Filter>folder\sub2</Filter>
</ClInclude>
<!-- This subfolder was not at the place -->
<ClInclude Include="folder1\file1.h">
<Filter>folder</Filter>
</ClInclude>
Upvotes: 2