0

I have an MSBuild script with a defined Target and ItemGroup.

Inside the target, i define a PropertyGroup like so:

<PropertyGroup>
    <StartedMessage>##teamcity[testStarted name='%(Names.Identity)']</StartedMessage>
    <FinishedMessage>##teamcity[testFinished name='%(Names.Identity)']</FinishedMessage>
    <TestStatus>testPassed</TestStatus>
</PropertyGroup>

The problem is, that these properties seem to be evaluated only once (when the target is called), and so do not reflect the correct value (Identity metadata) of the item that i'm iterating.

Is there any way to delay (lazy) evaluate the properties during execution? Or what is the proper way of defining "dynamic" properties that need to change when iterating an ItemGroup ?

lysergic-acid
  • 19,570
  • 21
  • 109
  • 218

1 Answers1

0

Not sure what the point of putting the itemgroup in a property group is trying to achieve, maybe something like this?

<Project  xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<Tests Include="Hack;Destroy;Terminate"/>
</ItemGroup>

<Target Name="Iterate">
<Message text="Started %(Tests.Identity)"/>
</Target>
</Project>
James Woolfenden
  • 6,498
  • 33
  • 53
  • The point was i'm trying to simplify the expressions needed to be written to avoid any errors. I'd like to create a property group, that for each run of the batched itemgroup's Identity element will contain the relevant item, then use this property inside the target (instead of writing the full string in every place it is needed). – lysergic-acid May 02 '13 at 10:49