What Does This MSBuild Snippet Do?

It's been a while since we've had a little quiz on MSBuild.

Over the last couple of days the MSBuild team has been enjoying working up solutions to a question over in our forums. Last night Faisal and Jeff concoted some MSBuild script that, to be honest, made my head turn sideways and then inside out.

Given the following MSBuild file, what is the output of the build?

<

Project xmlns="https://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<GroupA Include="file1.txt"/>
<GroupA Include="file2.txt"/>
<GroupA Include="file3.txt"/>
<GroupA Include="file4.txt"/>
</ItemGroup>

<ItemGroup>
<GroupB Include="file1.txt"/>
<GroupB Include="file3.txt"/>
<GroupB Include="file5.txt"/>
</ItemGroup>

<Target Name="Build">
<CreateItem Include="@(GroupA)" Condition="'%(Identity)' != '' and '@(GroupA)' != '' and '@(GroupB)' != ''">
<Output TaskParameter="Include" ItemName="GroupC"/>
</CreateItem>
<Message Text="@(GroupC)"/>
</Target>
</Project>

No running this on the command-line to find out! That'd be cheating :) See if you can figure it out in your noggin first, and then post your thoughts.

[ Author: Neil Enns ]