I have two ItemGroups:
<ItemGroup>
<Compile Include="A.cs" />
<Compile Include="B.cs" />
<Compile Include="C.cs" />
</ItemGroup>
<ItemGroup>
<PEG Include="A.cs" />
<PEG Include="Y.cs" />
<PEG Include="Z.cs" />
</ItemGroup>
I need to do add each of the items in PEG
to Compile
IF AND ONLY IF that item is not AREADY in Compile
.
Is there an easy way to do that?
My first attempt is something like:
<ItemGroup>
<Compile Include="%(PEG.Identity)" Condition=" '$(Compile)' != '%(PEG.Identity)' " />
</ItemGroup>
But that doesn't work for obvious reasons. I don't really want to do a manual anti-join in MSBuild.
Perhaps using Exclude
would work?