Partial class grouping

  • Thread starter Thread starter Brian Richards
  • Start date Start date
B

Brian Richards

Is there a way to get Studio to group your partial class files in the
Solution tree the way it automatically does with forms? (C#)

Thanks

Brian
 
I'm not sure if it can be done in the Visual Studio UI, but it can be done
by editing the .csproj file. For example, if I have a partial class called
TestClass split over two files called TestClass.cs and
TestClass.Internal.cs, then I can edit the .csproj file for both files as
follows:

<Compile Include="TestClass.cs" />
<Compile Include="TestClass.Internal.cs">
<DependentUpon>TestClass.cs</DependentUpon>
</Compile>

This will make TestClass.Internal.cs appear under TestClass.cs in Solution
Explorer.
 
That's a SWEET, SWEET tip (being serious here).
 
I have seen the <DependentUpon> tag in a vbproj file for a *newly* created
form where VS automatically put all the designer code into a partial class.
However, manually creating partial VB class files and editing the the vbproj
file to include the <DependentUpon> tags as described in your post does not
seem to put the file tagged as dependent under the primary file in Solution
Explorer. Any ideas?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top