5

In my .net core application, I would like to have my partial files put under a given file like it was with a .net framework application using the tag DependentUpon in the csproj.

As shown in a picture, I would like all Program.*.cs files to be under Program.cs.

enter image description here

However, in the .csproj file, I do not see the file listed:

enter image description here

Is there a way to do that in a .net core app?

Kzryzstof
  • 7,688
  • 10
  • 61
  • 108

1 Answers1

7

Yes, you just put an entry in an ItemGroup to update the implicit Compile elements from globbing. I'd personally use a separate ItemGroup element for this, away from your dependencies:

<ItemGroup>
  <Compile Update="Program.*.cs">
    <DependentUpon>Program.cs</DependentUpon>
  </Compile>
</ItemGroup>
Jon Skeet
  • 1,421,763
  • 867
  • 9,128
  • 9,194