조건 및 일괄 처리를 사용하여 항목을 필터링 할 수 있습니다. 항목의 메타 데이터가 필요한지 여부에 따라 상황에 따라 두 가지 접근 방식을 사용하고 있습니다.
- 대상 Filter1은 Identity로 항목을 복사하지만 원본 메타 데이터는 유지하지 않습니다.
- 대상 필터 2는 메타 데이터를 포함한 항목을 복사 한 다음 원하지 않는 항목을 제거합니다. Filter2의 장점은 모든 원본 메타 데이터가 있다는 것입니다.
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<DeployLabel Include="deploy\integration\foo.js">
<Dir>integration\</Dir>
<T>1</T>
</DeployLabel>
<DeployLabel Include="deploy\integration\foo2.js">
<Dir>integration\</Dir>
<T>2</T>
</DeployLabel>
<DeployLabel Include="deploy\integration\foo3.js">
<Dir>integration\</Dir>
<T>3</T>
</DeployLabel>
<DeployLabel Include="deploy\integration\bar.js">
<Dir>development\</Dir>
<T>0</T>
</DeployLabel>
</ItemGroup>
<Target Name="Filter1">
<ItemGroup>
<_DeployLabelHelper Include="%(DeployLabel.Identity)" Condition=" 'integration\' == '%(DeployLabel.Dir)' " />
</ItemGroup>
<Message Text="@(_DeployLabelHelper->'%(Identity):%(T)')"/>
</Target>
<Target Name="Filter2">
<ItemGroup>
<_RemovalHelper Include="%(DeployLabel.Identity)" Condition=" 'integration\' != '%(DeployLabel.Dir)' " />
<_DeployLabelHelper Include="@(DeployLabel)" />
<_DeployLabelHelper Remove="@(_RemovalHelper)" />
</ItemGroup>
<Message Text="@(_DeployLabelHelper->'%(Identity):%(T)')"/>
</Target>
</Project>