0

I use the Show All Files feature in the solution explorer that displays project files in a folder structure that mirrors the file system, instead of using Visual Studio's filters. My goal is to create a Visual Studio project outside of the source tree that still lists the files in their directory structure.

What I did so far is to create an empty solution and project in the directory structure shown below. Then I selected the three folders inside the src directory and dragged them into the project. They got added to the project but they show up as a plain list in the solution explorer, not in their native directory structure.

repository
├─ src
│  ├─ types
│  │  ├─ *.h
│  │  └─ *.cpp
│  ├─ managers
│  │  ├─ *.h
│  │  └─ *.cpp
│  └─ modules
│     ├─ *.h
│     └─ *.cpp
└─ project
   ├─ *.sln
   └─ *.vcxproj

How can I create a project that is located out of the source tree without breaking the mentioned file system view?

danijar
  • 32,406
  • 45
  • 166
  • 297
  • Wouldn't such a view show the source/file tree, as they're the same thing? – Alec Teal Mar 24 '14 at 18:37
  • @AlecTeal I don't completely get your comment. The `Show All Files` feature turns Visual Studio's weird filter based view off and just shows the file system instead. However, I don't know how to create out of the source tree projects (or solutions) in Visual Studio. Moreover, I don't know if the file system view would show the actual source tree then. – danijar Mar 24 '14 at 18:42
  • @danijar It is possible to create files (.h, .cpp, .xml, and others) that live outside the directory where the .sln file lives. You can add those files to a .vcproj file. When you do that, the view in the .sln file can be very different from the view of those files in the file system. – R Sahu Mar 24 '14 at 19:35
  • @RSahu So the solution can live outside the source tree while projects must be inside? – danijar Mar 25 '14 at 00:13
  • @danijar the solution, the project, and the source tree can all be in independent locations. – R Sahu Mar 25 '14 at 00:30
  • @RSahu When I have the project out of source tree, source files are displayed as a plain list in solution explorer. I want them to show up in their directory structure. Please see my update of the question. Can you help me? – danijar Mar 25 '14 at 09:28
  • @danijar I haven't forgotten that you asked me for help. I have been occupied with other things. – R Sahu Mar 28 '14 at 03:50

1 Answers1

1

I couldn't find out how to do out of source tree projects in Visual Studio so I think it is not supported. To solve the problem, we added all file names that Visual Studio uses to our .gitignore. Those lists are provided on the internet, for example by Github.

danijar
  • 32,406
  • 45
  • 166
  • 297