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
.
However, in the .csproj
file, I do not see the file listed:
Is there a way to do that in a .net core
app?
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>