27

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?

bytecode77
  • 14,163
  • 30
  • 110
  • 141

3 Answers3

18

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.

jt234
  • 662
  • 6
  • 16
  • 4
    That's pretty much the problem, everything is unfiltered when switching back to normal view. Also this way cpp and h files are both displayed in the same filter because they are in the same directory. – bytecode77 Mar 28 '13 at 09:37
  • 2
    @DevilsChild I understand your problem. As far as I know, what you are describing can not be done. I hope the option will be added in an update or next release. – jt234 Mar 28 '13 at 09:48
  • I hope so, too. For now I'm satisfied with the "Show All Files" option. – bytecode77 Mar 28 '13 at 13:02
  • You cannot use "Add class" and other context menus when in folder view. – Tomáš Zato May 18 '19 at 12:28
  • @DevilsChild Your comment helps quiet a lot, because when you state it's not possible, then I don't have to search anythiing more. Will need to wait for future releases. – Deepak Kiran Apr 28 '20 at 16:13
  • Thanks, this solve the problem! – User One Feb 13 '22 at 19:54
18

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

reloZid
  • 181
  • 1
  • 5
3

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!

Leo Chapiro
  • 13,678
  • 8
  • 61
  • 92