如何在 Visual Studio 中将多个文件保存在树中?
当您将(例如)WPF 窗口添加到项目时,VS 会创建 .xaml 和 .xaml.cs 文件。但是,它们不会显示在 VS Explorer 的平面列表中,而是 .xaml.cs 是 .xaml 文件的子文件(就树而言)。
如何将多个“自定义”文件组织到这样的树中? 例如,我有 Trainer.cs 文件和 Trainer.Builder.cs 文件。我希望 Builder 显示为 Trainer.cs 文件的子文件。怎么做呢?
请注意:我知道带有文件的文件夹,但我不想使用它,因为在这种情况下,即使“主”文件也被隐藏,我必须展开文件夹才能获取它。
更新
在搜索 VS2008 和 VS2010 之间的差异时,我发现我的整个问题是 SO 问题的重复 - 在那里你可以找到如何修复 VS2008 的修复程序以与 VS2010 一起使用:-)
When you add (for example) WPF window to your project VS creates .xaml and .xaml.cs files. However they are not displayed in a flat list in VS Explorer, rather .xaml.cs is a child file (in terms of the tree) of .xaml file.
How to organize several "custom" files into such tree? For example I have Trainer.cs file and Trainer.Builder.cs file. I would like Builder to be displayed as a child of Trainer.cs file. How to do it?
Please note: I know about folder with files, but I don't want to use it, because in such case even the "main" file is hidden and I have to unfold folder to get it.
Update
While searching for difference between VS2008 and VS2010, I found out, that my entire question is a duplicate of SO question -- there you find how to fix a fix for VS2008 to work with VS2010 :-)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这可以通过编辑注册表来完成。可以在此处找到针对 Visual Studio 2008 执行此操作的指南: http://blog.dotnetwise.com/2009/09/visual-studio-2008-custom-nested-files.html
您还可以通过Visual Studio 扩展,但除非这是更大项目的一部分,否则这可能有点过头了。这里有一个实现此行为的指南:http://pieterderycke.wordpress.com/2011/03/10/adding-support-for-nested-files-in-custom-visual-studio-project-types-with-mpf/
This can be done by editing the registry. A guide to doing this for Visual Studio 2008 can be found here: http://blog.dotnetwise.com/2009/09/visual-studio-2008-custom-nested-files.html
You can also do this through a Visual Studio Extension, but unless this is part of a larger project this is probably overkill. There is a guide to implementing this behavior here: http://pieterderycke.wordpress.com/2011/03/10/adding-support-for-nested-files-in-custom-visual-studio-project-types-with-mpf/