How to filter ItemGroup in MsBuild based on filename part?

前端 未结 1 1998
难免孤独
难免孤独 2021-01-12 11:22

I have an ItemGroup that contains some files (And I have no control on how this list is generated):


    

        
相关标签:
1条回答
  • 2021-01-12 11:50

    You need to use item batching using the % instead of the @. This will work on the items one by one instead of including them all at the same time. You had the condition right, which I assume you found somewhere else.

    <ItemGroup>
      <FilteredFiles Include="%(AllFiles.Identity)" Condition="$([System.Text.RegularExpressions.Regex]::IsMatch(%(Filename), '\.Tests\.dll'))"/>
    </ItemGroup>
    
    0 讨论(0)
提交回复
热议问题