2012-03-27 2 views
1

MSBuild 프로젝트에서 FooItem 항목 유형을 고려하십시오. 우리는 다음과 같은 항목에 대한 참조 및 메타 데이터 만들 수있는 작업에서는 항목 메타 데이터가 포함 된 MSBuild 미묘함?

:

%(FooItem.BarMetadata) 

또는

@(FooItem->'Metadata("BarMetadata")') 

또는

@(FooItem->'%(BarMetadata)') 

다음 세 가지 방법 사이에 어떤 차이가 있나요 , 나랑 똑같은 것 같니? 분명히 변환 구문 (->)은 일반적으로 더 강력하지만, 내가 알 수있는 것에서는 % 연산자의 사용에 해당하는 간단한 예제를 명시 적으로 제공했습니다.

또한 태스크 일괄 처리에 영향을 미칩니 까? (이 표현식이 태스크 항목에 있다고 가정 할 때)? 일반적으로 태스크의 메타 데이터를 참조하면서 메타 데이터로 태스크 일괄 처리를 방지하는 방법이 있는지 궁금합니다.

답변

3

이 아니며이 동일합니다. 변환 구문은 입력을 세미콜론으로 구분 된 Items 배열에 추가합니다. % 표기법은 입력을 ItemGroup Element에 추가합니다. >`-

TestMetadata: 
Transform: C:\MSBuild\File1.doc is Word Document;C:\MSBuild\File2.xls is Excel Document;C:\\MSBuild\File3.pps is PowerPoint Presentation 
Direct: C:\MSBuild\File1.doc is Word Document 
Direct: C:\MSBuild\File2.xls is Excel Document 
Direct: C:\MSBuild\File3.pps is PowerPoint Presentation
+0

그래서 기본적으로 당신이 말하고있는 것은 구문을 변형이다 (':

는 다음과 같은 대상을 고려 : 출력에서 ​​볼 수 있듯이

<Target Name="TestMetadata"> <ItemGroup> <Files Include="File1.doc"> <Description>Word Document</Description> </Files> <Files Include="File2.xls"> <Description>Excel Document</Description> </Files> <Files Include="File3.pps"> <Description>PowerPoint Presentation</Description> </Files> </ItemGroup> <Message Text="Transform: @(Files->'%(FullPath) is %(Description)')" /> <Message Text="Direct: %(Files.FullPath) is %(Files.Description)" /> </Target> 

을, 그 표기법은 다른 출력을 생성)는 일괄 처리를하지 않지만'%'는 ... 모든 것 같습니다. 맞습니까? – Noldorin

+0

아니요. 둘 사이에 배치가 거의 없으므로 배치에 모두 사용할 수 있습니다. 형식화되지 않은 간단한 문자열 배열이 필요할 때'->'를 사용합니다. – KMoraz

+0

하지만 분명히 * 첫 번째 경우에는 일괄 처리가되고 두 ​​번째 경우에는 일괄 처리입니다. 설명하십시오. – Noldorin

관련 문제