视觉解决方案资源管理器中的实际文件夹? [英] Actual folders in Visual Solution Explorer?

查看:222
本文介绍了视觉解决方案资源管理器中的实际文件夹?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

MS Visual Studio具有解决方案资源管理器,可以在其中查看所有项目文件,也可以创建类似于文件文件夹的过滤器,以将它们分组.问题是-我希望文件在视觉上和物理上都分为几组.但是我不想在Visual和磁盘上都两次应用每个更改.有什么方法可以在Visual Solution Explorer中显示实际的文件夹(将文件保存在磁盘上)(否-我刚刚检查了显示所有文件"没有执行此操作)?

MS Visual Studio has Solution Explorer where I can see all project files, I can also create filters which are like folders for files to keep them in groups. The problem is - I want my files divided in groups both in Visual and physically on my disk. But I don't want to have to apply each change twice both in Visual and on my disk. Is there any way to show actual folders, in which I keep my files on disk, in Visual Solution Explorer (and no - "Show all files" doesn't do that, I've just checked)?

推荐答案

否-SE和文件系统持有结构/层级信息的独立副本.

No - SE and the Filing System hold independent copies of the structure/hierachy information.

我通常会禁用过滤器并将文件放置在所需的位置,以便默认情况下这两个结构保持同步(实际上,如果您希望采用任何形式的源代码组织,则任何其他方式都看起来很疯狂-我总是组件inot的文件分组到单独的文件夹中.

I usually disable the filters and put files where I want them, so that the two structures remain in sync by default (indeed, any other way seems like madness if you want to have any kind of organisation of source code - I always group files for components inot separate folders).

然后(禁用过滤器)...

Then (with filters disabled)...

如果您在解决方案资源管理器中创建文件夹,并使用该文件夹中的上下文菜单来添加新项目..."或添加现有项目",则磁盘结构将反映解决方案资源管理器(将现有项目复制为(如果要添加到错误的SE文件夹中,则可能会导致文件的旧副本留在您的项目中),以确保它们不存在.否则,通常只有在您添加为链接"时,VS才会将项目放置在SE中与磁盘上显示的文件夹不同的文件夹中.

If you create the folders in Solution Explorer, and use the context menu from that folder to "Add new item..." or "Add existing item" then the disk structure will reflect the solution explorer (existing items are copied rather than referenced from where they currently reside to ensure this, which can result in old copies of files being left around your project if you add to the wrong SE folder). Otherwise it is usually only if you "add as link" that VS will put an item in a different folder in the SE than it appears on disk.

要整理起来,最简单的方法是(在制作备份副本以防万一之后):

To tidy things up, the easiest approaches are (after making a backup copy just in case):

  • 打开解决方案和文件浏览器,然后手动对其进行比较".应该使用正确的SE文件夹的上下文菜单将所有错误"的文件从SE中删除,移动到正确的磁盘位置,然后添加到SE .
  • 如果文件夹太多,则一种简单的方法是从解决方案资源管理器中删除所有文件,然后将它们(一次一个文件夹)添加回项目中,以确保您在创建正确的文件夹名称时转到,然后从每个文件夹的上下文菜单中添加.通过从头开始重新构建SE,您可以相当快地同步两种布局,这通常比试图找出差异所在要容易得多.
  • Open the solution and file explorers and manually "diff" them. Any files that are "wrong" should be removed from SE, moved to the correct disk location, and then added to SE by using the context menu for the correct SE folder.
  • If there aren't too many folders, a simpler approach is to just remove all files from solution explorer and then add them (one folder at a time) back into the project, ensuring that you create the correct folder names as you go, and add from each folder's context menu. By rebuilding the SE from scratch you can fairly quickly sync the two layouts, and this can often be easier than trying to work out where the differences lie.

一旦它们同步,就只能使用SE来管理文件,并小心使用上下文菜单中的正确文件夹添加项目.如果您在磁盘上移动东西,则会断开链接.

Once they're in sync, only use the SE to manage the files, and be careful to add items using the context menu from the correct folder. If you move things about on disk, you'll break the links.

这篇关于视觉解决方案资源管理器中的实际文件夹?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆