在Visual Studio中的另一个文件下分层显示文件

sar*_*ron 6 visual-studio solution-explorer

在Visual Studio中,我想显示某些文件之间的层次关系.

典型的ASP.NET WebForms应用程序提供了我想要的示例.假设我有一个名为的文件Page.aspx.文件命名Page.aspx.csPage.aspx.designer.cs通常低于层次出现Page.aspx在Solution Explorer.

sar*_*ron 6

如果希望文件A在解决方案资源管理器中的文件B下按层次结构显示,请执行以下操作:

打开项目文件,转到文件A 的<Content Include>(或者<None Include>有什么)节点<DependentUpon>File B</DependentUpon>并向其添加子节点.结果看起来应该类似于:

<Content Include="File A">
  <DependentUpon>File B</DependentUpon>
</Content>`
Run Code Online (Sandbox Code Playgroud)

  • 这个扩展使它更容易:https://visualstudiogallery.msdn.microsoft.com/3ebde8fb-26d8-4374-a0eb-1e4e2665070c (3认同)