Chau Chee Yang
Chau Chee Yang

Reputation: 19690

Is it reasonable to define repeated ItemMetadata?

In MSBuild, we may define Item metadata as:

    <ItemGroup>
        <DProjs Include="$(GroupProjPath)app.dproj">
            <DCP>test1</DCP>
        </DProjs>
    </ItemGroup>

I may also define duplicate Item metadata:

    <ItemGroup>
        <DProjs Include="$(GroupProjPath)app.dproj">
            <DCP>test1</DCP>
            <DCP>test2</DCP>
            <DCP>test3</DCP>
        </DProjs>
    </ItemGroup>

But how would I access 3 distinct item metadata value?

<Message Text="%(DProjs.DCP)" />

always return test3.

Upvotes: 1

Views: 50

Answers (1)

JDługosz
JDługosz

Reputation: 5652

You could make the metadata value <DCP>test1;test2;test3</DCP> which is what you would expect if repeated values were allowed. You can use the CreateItem task to turn it into a list of items that can then be batched (looped over), or use it however you meant.

Upvotes: 3

Related Questions