This question already has an answer here:
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.
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>`
来源:https://stackoverflow.com/questions/31432523/display-a-file-hierarchically-under-another-file-in-visual-studio