Show grouped partial files

Asked

Viewed 32 times

0

I’m creating a partial class, and I’d like to implement some validations in another partial class, just to separate the methods.

I know that this is possible, but I would like to join these two sources, that would be possible?

For example:

Where is the source of RepositorioPais, would like to create a class RepositorioPais.Validacao and attach the two together, the same is done in the forms created by C#. See image 2.

Imagem 1

Form

Imagem 2

  • This extension for Visual Studio does this automatically, no manual editing required: https://marketplace.visualstudio.com/items?itemName=MadsKristensen.FileNesting

1 answer

1


Just editing manually the file . csproj.

If you’re willing to do this, here are the steps.

  1. Close the project in Visual Studio

  2. Open the file . csproj with any text editor

  3. Look for this (note that they will not necessarily be below each other)

    <Compile Include="RepositorioPais.cs" />
    <Compile Include="RepositorioPais.Validacao.cs" />
    
  4. Change these two items to

    <Compile Include="RepositorioPais.cs" />
    <Compile Include="RepositorioPais.Validacao.cs">
      <DependentUpon>RepositorioPais.cs</DependentUpon>
    </Compile>
    
  5. Reopens the project

  • worked well friend, but I know that there is a way to accomplish this via the application of visual studio, only that I do not remember the name of the component, know of some ?

  • You have this one: https://marketplace.visualstudio.com/items?itemName=MadsKristensen.FileNesting

  • Wonderful, it was the same one that needed, but had not been able to find in the Nuget. thanks really.!

Browser other questions tagged

You are not signed in. Login or sign up in order to post.