I've discovered, somewhat by accident, that it's also possible to have an ItemGroup element work nested in a Target element. Here's an example of what I mean:
<Target Name="SetMetaData">
<ItemGroup>
<MyItems Condition=" '%(MyItems.MyOtherMetaData)'=='true' " >
<MyMetaData>$(MyMetaDataValue)</MyMetaData>
</MyItems>
</ItemGroup>
</Target>
This makes it quite easy to add/ modify item metadata.
This fact may be well-known by experienced MSBuild users, but as a beginning-level MSBuild student, I rely heavily on these MSDN docs, and I've not seen this behavior documented anywhere in here.
--
This is only true in MSBuild 3.5. You also have to have ToolsVersion="3.5" defined in the project section or it will not work.
Vaccano