Scope and order of evaluation of Items in MsBuild

I wonder why in the following code, MsBuild refuses to set the Suffix Metadata. It does work with a CreateItem task instead of the ItemGroup Declaration (because CreateItem is computed at build time) but I can't do this here because this code is in a "property file" : the project has no target, it's just a bunch of properties/items I include in real projects.

<ItemGroup>
        <Layout Include="Bla">
            <PartnerCode>bla</PartnerCode>
        </Layout>
        <Layout Include="Bli">
            <PartnerCode>bli</PartnerCode>
        </Layout>
</ItemGroup>

<ItemGroup Condition="'$(LayoutENV)'=='Preprod'">
        <LayoutFolder Include="Preprod">
            <Destination>..\Compil\layout\pre\</Destination>
        </LayoutFolder>
</ItemGroup>


<ItemGroup>
    <Destinations Include="@(LayoutFolder)" >
        <Suffix>%(Layout.PartnerCode)</Suffix>
    </Destinations>
</ItemGroup>

Destinations is well built but the Suffix Metadata is not set.

As for now, I have duplicated the Destinations Definition in every project I needed it but it's not very clean. If someone has a better solution, I'm interested!

1
задан Benjamin Baumann 2 September 2010 в 16:41
поделиться