Rajeshwar
Rajeshwar

Reputation: 11661

Filters in a VS2010 project lost after a restart

I had organized my files (.cpp and .h) in a VS2010 C++ project into separate filters. After a sudden restart the folders are gone but the files are still there . Is there any way for me to recover those folders or do i have to reorganize again ?

Update: It seems that when i right click on the project I do not get the add new filter option instead i get add new folder option. How do i add new filters to this project now

Upvotes: 1

Views: 2804

Answers (3)

Niall
Niall

Reputation: 1

I had this issue recently with a C++ project in VS2019, where the project filters had disappeared. The root cause was that the .vcxproj.filters XML file had become corrupted somehow and a </ClCompile> closing tag was left out. The IDE does not display any obvious error for it and simply flattens the filters.

With hindsight, time could be saved by checking the .vcxproj.filters XML file in another app, e.g. XML Notepad to validate the XML document for any structural or encoding issues.

https://microsoft.github.io/XmlNotepad/

Upvotes: 0

Eddy Luten
Eddy Luten

Reputation: 432

If you prefer physical file-system directories instead of logical filters, you can click on the "Show All Files" button atop the Solution Explorer panel and create the directories from within Visual Studio.

Show All Files

This method doesn't require a .vcxproj.filters file and gives you the option to keep your file structure sane (i.e. not having an enormous amount of files in a single directory).

Upvotes: 3

Richard Walters
Richard Walters

Reputation: 1474

In VS2010, they aren't folders, they're filters. They are logical groupings that are managed in your .vcxproj.filters file, which is XML-based (make a new C++ project and take a look at the file in a simple text editor, if you're curious). Most likely, that file got corrupted or wasn't saved properly when you had the sudden restart, and you'll have to reorganize them again.

Upvotes: 2

Related Questions