I'm trying to create a filtered item group from another one, where the filtered item group will only contain items from the first group that have a specified file extension.
I'm getting the following error:
error MSB4190: The reference to the built-in metadata "Extension" at position 1 is not allowed in this condition "'%(Extension)'=='.sys'".
When I run this:
<?xml version="1.0" encoding="utf-8"?>
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003"
DefaultTargets="Go"
ToolsVersion="4.0">
<ItemGroup>
<Files Include="X.exe"/>
<Files Include="Y.sys"/>
</ItemGroup>
<ItemGroup>
<SysFiles Include="%(Files.Identity)" Condition="'%(Extension)'=='.sys'">
</SysFiles>
</ItemGroup>
<Target Name="Go">
<Message Text="SysFiles=@(SysFiles)"/>
</Target>
</Project>
Firstly, I can't understand why the meta data isn't allowed at this position? Is it some artificial restriction or unimplemented part of msbuild?
Secondly, what's a concise way of achieving this kind of transform?
Thanks very much.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…