2013-07-04 2 views
0

몇 세트의 항목이 있으며 세트가 부분적으로 교차합니다. 모든 세트에는 소스 파일이 들어 있습니다. 그러한 세트는 모두 별도로 컴파일해야합니다. 이를 달성하기위한 방법은 메타 데이터를 사용하는 것이었지만 방법을 알 수는 없습니다. 아래는 내 설정입니다 :메타 데이터를 기반으로 항목 그룹을 선택하십시오.

저는 프로젝트 파일을 생성하고 있습니다. 따라서 다르게 수행 할 수 있지만 자동으로 수행 할 수 있습니다. 괜찮습니다.

답변

0

조건 및 일괄 처리를 사용하여 항목을 필터링 할 수 있습니다. 항목의 메타 데이터가 필요한지 여부에 따라 상황에 따라 두 가지 접근 방식을 사용하고 있습니다.

  1. 대상 Filter1은 Identity로 항목을 복사하지만 원본 메타 데이터는 유지하지 않습니다.
  2. 대상 필터 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> 

관련 문제