【发布时间】:2023-09-01 08:26:01
【问题描述】:
我有几个项目应该从 Content、Compile 和 EmbeddedResource 中删除。 我现在这样做:
<Content Remove="data\**" />
<Content Remove="other\**" />
<Content Remove="etc\**" />
<Compile Remove="data\**" />
<Compile Remove="other\**" />
<Compile Remove="etc\**" />
<EmbeddedResource Remove="data\**" />
<EmbeddedResource Remove="other\**" />
<EmbeddedResource Remove="etc\**" />
这可行,但会使项目文件显着膨胀。理想情况下,我想创建类似的东西:
<RemoveAll Include="data\**" />
... some magic that checks RemoveAll and
emits Content, Compile and EmbeddedResource for all RemoveAlls
...
这在 csproj 中可能吗?我已经对目标进行了一些实验,但我无法获得删除这些项目的目标。
【问题讨论】:
-
作为替代方案,您能否将所有这些资源放在一个子文件夹中,然后排除该子文件夹?
-
@MatthewWatson 不,不幸的是我无法控制它,它是由第三方依赖创建的。
标签: c# visual-studio csproj