6

In Visual Studio, I'd like to show a hierarchical relationship between certain files.

A typical ASP.NET WebForms application provides an example of what I want. Say that I have a file named Page.aspx. Files named Page.aspx.cs and Page.aspx.designer.cs would typically appear hierarchically below Page.aspx in Solution Explorer.

DavidRR
  • 18,291
  • 25
  • 109
  • 191

1 Answers1

6

If you want File A to appear hierarchically under File B in Solution Explorer, do the following:

Open your project file, go to the <Content Include> (or <None Include>, or what have you) node for File A and add a <DependentUpon>File B</DependentUpon> child to it. The result should look similar to this:

<Content Include="File A">
  <DependentUpon>File B</DependentUpon>
</Content>`
DavidRR
  • 18,291
  • 25
  • 109
  • 191
  • 3
    This extensions makes it a little easier : https://visualstudiogallery.msdn.microsoft.com/3ebde8fb-26d8-4374-a0eb-1e4e2665070c – Damian Green Oct 13 '15 at 14:29