I would like to create a new item collection with modified metadata. For example, change the delimiters of the ClCompile.AdditionalIncludeDirectories. In order to do so I first create an item collection from the AdditionalIncludeDirectories metadata, and then transform it:
<ItemGroup>
<IncludeDirs0 Include="%(ClCompile.AdditionalIncludeDirectories)">
<key>@(ClCompile)</key>
</IncludeDirs0>
</ItemGroup>
<ItemGroup>
<IncludeDirs Include="@(IncludeDirs0 -> '-I %(Identity)', ' ')">
<key>%(IncludeDirs0.key)</key>
</IncludeDirs>
</ItemGroup>
<ItemGroup>
<Compile Include="@(ClCompile)">
<IncludeDirs>@(IncludeDirs)</IncludeDirs>
</Compile>
</ItemGroup>
The problem is how to filter IncludeDirs on Compile item group, such that each Compile item will have its right include dir. (so that ClCompile identity equals IncludeDirs key).
I've tried adding a condition such as: Condition="'%(IncludeDirs.key)'=='%(ClCompile.Identity)'"
but without any success.
I could have used the IncludeDirs directly: <Message Text="%(IncludeDirs.key) : @(IncludeDirs)"/>
but I feel this misses the point, since the Compile collection should contain all the metadata.
What did I miss here?