.net 核心应用程序中是否有 DependentUpon 选项?

Kzr*_*tof 2 c# csproj .net-core

在我的.net core申请,我想有我使用的标签给定文件划归就像是一个.NET Framework应用程序的部分文件DependentUponcsproj

如图所示,我希望所有Program.*.cs文件都在Program.cs.

在此处输入图片说明

但是,在.csproj文件中,我没有看到列出的文件:

在此处输入图片说明

有没有办法在.net core应用程序中做到这一点?

Jon*_*eet 5

是的,您只需在 an 中ItemGroup添加一个条目即可更新Compile来自 globbing的隐式元素。我个人会ItemGroup为此使用一个单独的元素,远离您的依赖项:

<ItemGroup>
  <Compile Update="Program.*.cs">
    <DependentUpon>Program.cs</DependentUpon>
  </Compile>
</ItemGroup>
Run Code Online (Sandbox Code Playgroud)