Search code examples
visual-studiovisual-studio-2005solution-explorer

Is there any way to do custom "grouping" of files in Visual Studio's Solution Explorer?


To explain a little more, I have a file Sidebar.cs, and I have Sidebar.js, and Sidebar.css.

I would like to be able to make it Sidebar.cs, Sidebar.cs.js, and Sidebar.cs.css, and have the js and css file go "under" (as children of) the Sidebar.cs node in the treeview, just like what happens with .designer files and .aspx.cs files.

Is this possible to accomplish?


Solution

  • Open up the project file in a text editor or using the "edit project file" context menu (might be only part of an add-in I have). You can then use the DependentUpon XML tag to get the hierarchy. For example, this is how a Form and it's designer look:

    <Compile Include="Views\SSWizardForm.cs">
      <SubType>Form</SubType>
    </Compile>
    <Compile Include="Views\SSWizardForm.designer.cs">
      <DependentUpon>SSWizardForm.cs</DependentUpon>
    </Compile>
    

    Note the "DependentUpon" tag, meaning "make this a child of another file".