How to make (.cs) code files expand / collapse under different code in Visual Studio Solution Explorer?

In Visual Studio 2008/2010, you can place a number of simple .cs code files under another .cs file in Solution Explorer. This behavior is similar to the way you see files hosted when adding WPF UserControl to a solution where, instead of a single .cs file, it can collapse / expand under the .xaml file.

How to make a decision to organize files this way? I have already looked through some of the obvious places, such as the file properties panel, solution pages, and .csproj.

+3
source share
2 answers

, Visual Studio.

, .csproj. , <DependentUpon> XML , .

<Compile Include="Settings.Designer.cs">
  <AutoGen>True</AutoGen>
  <DependentUpon>Settings.settings</DependentUpon>
  <DesignTimeSharedInput>True</DesignTimeSharedInput>
</Compile>
+5

.csproj :

<Compile Include="Form1.Designer.cs">
  <DependentUpon>Form1.cs</DependentUpon>
</Compile>

VSCommands Visual Studio 2010.

+5

Source: https://habr.com/ru/post/1762879/


All Articles