visual-studio - 在Visual Studio中丢失了项目目录结构?

标签 visual-studio visual-studio-2015 directory-structure solution

我正在学习Visual Studio 2015社区。我是一个经验丰富的程序员,但是对VS还是陌生的,文件表示形式使我感到困惑。我创建了一个解决方案,并添加了一个现有项目。 VS在“解决方案资源管理器”中以一棵树的级别向我显示了所有项目文件(在我的情况下是C++项目,所以是.c.cpp.h文件)。

相反,如果我用Sublime Text,VS Code,notepad++之类的文件打开上述项目,则会看到正确的目录结构,因为它位于磁盘驱动器上。就像在终端的File 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中正确的目录结构?

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

从下面的屏幕快照中可以看到,它们都整齐地排列在磁盘上的不同文件夹中,但是VS对这些文件的表示非常困惑:

enter image description here

enter image description here

最佳答案

我发现@Paul Easter在下面的主题中给出的答案对于理解这个“怪癖”非常有帮助,这确实是一个“功能”。一个不同的项目结构概念正在起作用:

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中的基础文件断开了奇怪而异常的连接。我必须承认这一层存在异常,这会给我带来麻烦。

关于visual-studio - 在Visual Studio中丢失了项目目录结构?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42985816/

相关文章:

visual-studio - 大解决方案,许多解决方案配置,添加一个新项目

c# - 如何实现语法高亮方案?

c++ - 错误 C2955 : 'CELL' : use of class template requires template argument list C++ Stack

c# - 找不到类型或命名空间名称 'System'

c++ - pcl_visualizer.cpp 与 2015 构建错误

c# - 在 .NET 中移动不同卷上的文件

c# - C++/CLI 项目如何在控制台窗口中显示消息?

sql-server - 是否可以在 Visual Studio 架构比较中忽略 NOT FOR REPLICATION?

php - Zend Framework 2 - route 的尾部斜杠

linux - 关于两种情况之间的 grep 选项