views:

64

answers:

3

In Visual Studio 3 files are typically grouped together:

  1. filename.aspx
  2. filename.aspx.cs
  3. filename.aspx.designer.cs

Is there a way to add another file that grouping so that it can be collapsed and out of view?

  1. filename.aspx
  2. filename.aspx.cs
  3. filename.aspx.designer.cs
  4. customfile.cs

Thanks

+3  A: 

If you open the .csproj file, you'll see how it's done. Try following the pattern to add your new file.

For example:

<Compile Include="Default.aspx.cs">
  <DependentUpon>Default.aspx</DependentUpon>
  <SubType>ASPXCodeBehind</SubType>
</Compile>
John Saunders
Fantastic - love it!
Daniel
@John: thanks for the edit.
John Saunders
A: 

Here's the xml (corresponding to the example)

<Compile Include="customfile.cs">
  <DependentUpon>filename.aspx</DependentUpon>
</Compile>

Works like a charm.

Daniel
+1  A: 

I've created a Visual Studio adding that does it (and more). It works with VS 2008 and 2010 and you can check it out here: http://mokosh.co.uk/vscommands

jarek