Visual Studio 解决方案资源管理器中的文件名折叠问题(“文件嵌套”)
(编辑搜索能力:称为“文件嵌套”)
我不确定“折叠”是否是正确的术语,但我指的功能是如下面的第一张图片所示,第二张图片没有用于代码隐藏文件的可扩展树列表节点。
- 折叠:
- 不折叠:
我的问题是:
- 此功能的正确名称是什么?
- 我该如何设置?
- 当我尝试将网站项目转换为Web应用程序项目时,为什么我的解决方案资源管理器没有启用此功能?
参考资料:
编辑
感谢肖恩,但正如您在下面看到的,由于某种原因,我的 Nest 相关文件
按钮确实出现在该项目中:
应具有如下所示的按钮:
编辑:
我找出了原因:我不小心创建了一个 C# Web 应用程序项目,然后向其中添加了 VB ASP.NET 文件。
(Edit for search-ability: called "File Nesting")
I'm not sure if "folding" is the correct term, but the feature I'm referring to is shown in the 1st image below, versus the 2nd one which does not have an expandable tree list node for the code behind file.
- Folding:
- No folding:
My questions are:
- What is the correct name of this feature?
- How do I set it?
- Why does my Solution Explorer not have this feature enabled when I try to convert my Web Site Project to a Web Application Project?
References:
Edit
Thanks Sean, but as you can see below, my Nest Related Files
button does show up in this project for some reason:
Should have button shown below:
Edit:
I figured out the reason: I accidentally created a C# Web Application Project, and then added VB ASP.NET files to it.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
请参阅此相关问题以了解可能的注册表黑客攻击(在问题的注册表脚本中将 9.0 更改为 8.0):
Visual Studio 2010 相关文件嵌套
see this related question for a possible registry hack (changing 9.0 to 8.0 in the question's reg script):
Visual Studio 2010 related file nesting
当您不使用网站项目时,解决方案资源管理器中的嵌套按钮不会出现,但您仍然可以在 .NET 5.0 项目中嵌套文件。
操作方法如下:
.csproj
文件。 Visual Studio 可以在自己的查看器中打开它,或者您也可以使用您喜欢的 XML 或文本编辑器。Item Group
元素。如果已有包含您的一些文件的文件,请将其放在那里以保持整洁和一致性。如果没有,请创建一个新的。Content
元素。该元素的Include
属性应该是您所需文件的名称。DependentUpon
子元素添加到您的内容元素中。该元素的文本值应该是您希望在其下嵌套目标文件的文件的名称。解决这种情况的问题和答案少得惊人。上面的答案对我没有帮助,所以我想我会为后代分享我所做的事情。
When you are not using a website project, the nesting button in the solution explorer won't appear—but you can still nest files in .NET 5.0 projects.
Here's how you do it:
.csproj
file. Visual studio can open it in its own viewer, or else you can use your favorite XML or text editor.Item Group
element. If there's already one that includes some of your files, put it in there for cleanliness and consistency. If there isn't, create a new one.Content
element for the file you wish to nest. This element'sInclude
attribute should be the name of your desired file.DependentUpon
child element to your content element. This element's text value should be the name of the file you wish to nest your target file underneath.There's shockingly few questions and answers that address this situation. The above answer didn't help me, so I figured that I would share what did for posterity.