I would like to create a custom task that is called in a fashion such as this:
<Target Name="Remap">
<ItemGroup>
<Entry Key="key1" Value="value1" />
<Entry Key="key2" Value="value2" />
</ItemGroup>
<CustomTask
Entries="@(Entry)"
/>
</Target>
Or this:
<Target Name="Remap">
<ItemGroup>
<Entry>
<Key>key1</Key>
<Value>value1</Value>
</Entry>
<Entry>
<Key>key2</Key>
<Value>value2</Value>
</Entry>
</ItemGroup>
<CustomTask
Entries="@(Entry)"
/>
</Target>
I tried just using:
public class CustomTask : Task
{
public override bool Execute()
{
...
}
[Required]
public ITaskItem[] Entries { get; set; }
}
But in the first case, I get the error:
error MSB4066: The attribute "Key" in element <Entry> is unrecognized.
And in the second case, while there is no error, the Entries collection is just empty.
Is there a way to accomplish this with MsBuild custom tasks?