visual-studio 具有多个文件夹的 Visual Studio 项目
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 
原文地址: http://stackoverflow.com/questions/645062/
Warning: these are provided under cc-by-sa 4.0 license.  You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Visual Studio projects with multiple folders
提问by rlbond
Is there an easy way to use multiple folders in a project with Visual Studio? It has "filters" which look like folders, but it would be really nice to be able to make folders and insert files in them inside VS. Is there an add-in or secret option to enable this behavior?
有没有一种简单的方法可以在 Visual Studio 的项目中使用多个文件夹?它具有看起来像文件夹的“过滤器”,但是能够在 VS 中创建文件夹并在其中插入文件真的很棒。是否有加载项或秘密选项来启用此行为?
回答by Brian R. Bondy
With VC++, the folders do not correspond directly with what's on your file system. They are simply used to help you organize your project in an independent manner.
使用 VC++,文件夹与文件系统上的内容不直接对应。它们只是用来帮助您以独立的方式组织您的项目。
The reason they have this design decision is because with C++ you typically have many include and source directories.
他们有这个设计决定的原因是因为使用 C++ 你通常有许多包含和源目录。
More on Filters:
更多关于过滤器:
At the top of your "Solution Explorer" window you will see a toolbar button that when hovered over says "Show All Files". If this button is pressed it does not show you a Folder/Filter structure. If this button is not pressed it shows you the Folder/Filter structure.
在“解决方案资源管理器”窗口的顶部,您将看到一个工具栏按钮,将鼠标悬停在该按钮上时会显示“显示所有文件”。如果按下此按钮,它不会向您显示文件夹/过滤器结构。如果未按下此按钮,则会显示文件夹/过滤器结构。
To add a new Folder/Filter, right click on a project of your solution and select Add -> New Filter.
要添加新文件夹/过滤器,请右键单击解决方案的项目并选择添加 -> 新过滤器。
Note that for each Folder/Filter that you create you can go into the Folder/Filter properties and set things such as:
请注意,对于您创建的每个文件夹/过滤器,您可以进入文件夹/过滤器属性并设置诸如:
- Parse files: Whether to parse the files in this folder for auto completion
- SCC Files: Whether the files in this folder should be considered for source control
- Filter: Specifies the file types that this folder will hold by default.
- 解析文件:是否解析此文件夹中的文件以自动完成
- SCC 文件:是否应考虑对该文件夹中的文件进行源代码控制
- 过滤器:指定此文件夹默认保存的文件类型。

