9

We use allot of partial classes in C# to categorise our code for large classes. In the solution explorer we will have code files listed as such:

- MyClass.cs
- MyClass.Partial1.cs
- MyClass.Partial2.cs

But what we want to have is something like this (as you would see with designer files etc.):

- MyClass.cs
    ˪ MyClass.Partial1.cs
    ˪ MyClass.Partial2.cs

I'm aware that you can modify the project file manually to set-up this dependency like this:

<Compile Include="MyClass.cs" />
<Compile Include="MyClass.Partial1.cs">
    <DependentUpon>MyClass.cs</DependentUpon>
</Compile>
<Compile Include="MyClass.Partial2.cs">
    <DependentUpon>MyClass.cs</DependentUpon>
</Compile>

Is there a short-cut in visual studio? Or maybe an extension that will help with this? (Without needing to edit the project file manually)

Francois Nel
  • 1,363
  • 1
  • 14
  • 28

1 Answers1

8

Duplicate of this and this question.

Their answer: Group Items as available in VSCommands for Visual Studio 2010

There is also a plugin that does only this: NestIn

Update
There is a second plugin that does pretty much the same thing: File Nesting

Community
  • 1
  • 1
Laoujin
  • 9,438
  • 6
  • 36
  • 66