Visual Studio 中丢失了项目目录结构?

Project Directory Structure Lost in Visual Studio?

我正在学习 Visual Studio 2015 社区。我是一名经验丰富的程序员,但是 VS 新手,文件表示让我感到困惑。我创建了一个解决方案,并添加了一个现有项目。 VS 在解决方案资源管理器的一个树级别上向我显示所有项目文件(在我的例子中是 C++ 项目,因此 .c.cpp.h 文件)。

相比之下,如果我在 Sublime Text、VS Code、notepad++ 等工具中打开所述项目,我会看到正确的目录结构,因为它位于磁盘驱动器上;正如人们在终端中的文件 Explorer/Finder 或 ls/dir 中看到的那样。

我在发帖前做了功课,在下面的帖子中,@Andrey 指出:

I am afraid there is no such concept in MSVS like "directory structure". Moreover, MSVS doesn't really need it because it uses flat projects and hierarchies are based on project level, not on the file/directory level.

As there is no such thing - you can't have it neither automatically nor manually. MSVS has solution folders which is quite different thing and there isn't much sense in expressing real folders as solution folders.

Visual Studio as Code Browser : How to preserve the directory structure?

这是真的吗?文件的排列有很多意义,VS中的平面表示使项目更难理解;文件在目录结构中的位置很重要。有没有办法在 VS 中查看正确的目录结构?

在我的情况下,我正在使用支持多个版本(4.0、4.1、4.2 等)的 Quickfix。每个都有不同的 类 和同名文件。

正如您从下面的屏幕截图中看到的,它们都整齐地排列在磁盘上的不同文件夹中,但是 VS 对这些文件的表示非常混乱:

我发现@Paul Easter 在下面的帖子中给出的答案非常有助于理解这个 "quirk," 这实际上是一个 "feature." 一个不同的项目结构概念在起作用:

But as for the reason you do not want solution folders to behave like "physical" folders is because your solution layout may not necessarily use the same convention as your source control layout. Solution folders allow you to customize the hierarchy of your projects so that you can group projects and items together any way you like, and then decide you don't like it and change it again without having to go through the nightmare of moving source control items around and irritating the rest of your team.

Visual Studio Solutions Folder as real Folders

这是个好主意吗?我可以看到有些人喜欢它的地方,因为它允许他们按照自己的意愿安排项目文件。在这一点上,我不喜欢它;我敢肯定,部分原因是它对我来说是新的,但也有两个原因:
1.在一个有组织的项目中,目录层次不是随意的;首席工程师出于充分的理由以某种方式排列文件。
2.它在VS文件表示和操作系统结构之间增加了一个抽象层。我喜欢直接访问我正在处理的文件;使用 VS 系统时,我觉得与 VS 中的底层文件断开连接是一种奇怪而诡异的感觉。我必须承认担心这一层有异常,会给我带来麻烦。