001 – Join ItemGroups based on Metadata

Problem Statement

How can two different item groups be joined based on metadata



<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
    <Target Name="Default">
        <!– Group1 Items –>
        <Group1 Include="Red">
        <Group1 Include="Yellow">
        <Group1 Include="Green">
        <!– Group2 Items –>
        <Group2 Include="Blue">
        <Group2 Include="Grey">
        <Group2 Include="Silver">
        <!– Combine the groups where IsFavorite is true –>
        <Group3 Include="@(Group1);@(Group2)" Condition="’%(IsFavorite)’ == ‘true’"/>
      <!– Display the results –>
      <Message Text="Group 1 – %(Group1.Identity)"/>
      <Message Text="Group 2 – %(Group2.Identity)"/>
      <Message Text="Group 3 – %(Group3.Identity)"/>



Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s