Функция свойства Msbuild содержится в метаданных? - PullRequest
0 голосов
/ 30 июня 2018

Есть ли способ проверить, содержит ли метаданные строку? Например:

<Test Include="@(Content)" Condition="%(Identity.Contains('AppxContentGroupMap.xml'))" />

1 Ответ

0 голосов
/ 09 июля 2018

Вы ищете WithMetadataValue, что ItemFunction

https://msdn.microsoft.com/en-us/library/ee886422.aspx

<ItemGroup>  
    <TheItem Include="first">  
        <Plant>geranium</Plant>  
    </TheItem>  
    <TheItem Include="second">  
        <Plant>algae</Plant>  
    </TheItem>  
    <TheItem Include="third">  
        <Plant>geranium</Plant>  
    </TheItem>  
</ItemGroup>  

<Target Name="go">  
    <Message Text="MetaData:    @(TheItem->Metadata('Plant'))" />  
    <Message Text="HasMetadata: @(theItem->HasMetadata('Plant'))" />  
    <Message Text="WithMetadataValue: @(TheItem->WithMetadataValue('Plant', 'geranium'))" />  
    <Message Text=" " />  
    <Message Text="Count:   @(theItem->Count())" />  
    <Message Text="Reverse: @(theItem->Reverse())" />  
</Target>  

  <!--   
  Output:  
    MetaData:    geranium;algae;geranium  
    HasMetadata: first;second;third  
    WithMetadataValue: first;third  

    Count:   3  
    Reverse: third;second;first  
  -->  
Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...