简体   繁体   中英

Visual Studio & C++: Use filters as directories

I Use Visual Studio 2012 Professional and C++ . When creating so called 'filters' and adding source files to them, the files in the solution explorer are divided into sub directories, while on the file system they are all in the same directory (the project directory)

Question: I want to add a file to a filter while at the same time adding it to the corresponding directory on the file system. How can this be accomplished other than manually moving files around?

One alternative would be to switch to "Show All Files" in Solution Explorer top menu.

This way you can move and manage files in folders.

Filters will not get used though.

The "Show All Files" solution did not work for me because in my case the source files were not located under the directory containing the project file.

I finally ended up with writing a VS extension which allows you to organize either the filter structure inside the project or the file structure on the disk automatically by invoking a command through the context menu. I thought some of you might be interested in that extension too:

https://github.com/reloZid/vc-fileutils

I know only this workaround: you create first the folder structure in windows explorer and then drag / drop the files / folder from windows explorer into the solution explorer of Visual Studio. It will add them all as a "filter" to Visual Studio!

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM