msbuild
プロパティと項目評価の順序
サーチ…
備考
詳細については、MSDNドキュメンテーションページのプロパティと項目の比較 順序の プロパティと項目の比較を参照してください。
評価の順序を示す例
MSBuildは、 Project要素の直下にあるPropertyGroup 、 ChooseおよびItemGroup要素をTarget要素に含まれる要素よりも前に評価します。
-
Project要素の直下で、PropertyGroup要素とChoose要素が表示された順に評価され、次にItemGroup要素が表示される順序で評価されます。 -
Target要素では、PropertyGroupとItemGroupは等しい優先順位で共有され、表示順に評価されます。
Importを介して参照されるファイル内では、MSBuildは上記と同じ方法でPropertyGroup 、 ChooseおよびItemGroup評価し、 Importファイルの内容はImportが配置されているインラインで表示されているように見えます。
以下のコメントは、MSBuildが選択した行を評価する前後のプロパティ値と項目数を示しています。
<Project DefaultTargets="FooTarget" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Target Name="FooTarget">
<ItemGroup>
<!-- '$(FooProp)' == '2', '@(FooItem->Count())' == '1' -->
<FooItem Include="foo value B" />
<!-- '$(FooProp)' == '2', '@(FooItem->Count())' == '2' -->
</ItemGroup>
<PropertyGroup>
<!-- '$(FooProp)' == '2', '@(FooItem->Count())' == '2' -->
<FooProp>3</FooProp>
<!-- '$(FooProp)' == '3', '@(FooItem->Count())' == '2' -->
</PropertyGroup>
</Target>
<ItemGroup>
<!-- '$(FooProp)' == '2', '@(FooItem->Count())' == '0' -->
<FooItem Include="foo value A" />
<!-- '$(FooProp)' == '2', '@(FooItem->Count())' == '1' -->
</ItemGroup>
<PropertyGroup>
<!-- '$(FooProp)' == '', '@(FooItem->Count())' == '0' -->
<FooProp>1</FooProp>
<!-- '$(FooProp)' == '1', '@(FooItem->Count())' == '0' -->
</PropertyGroup>
<Choose>
<When Condition=" '$(FooProp)' == '1' ">
<!-- '$(FooProp)' == '1', '@(FooItem->Count())' == '0' -->
<FooProp>2</FooProp>
<!-- '$(FooProp)' == '2', '@(FooItem->Count())' == '0' -->
</When>
</Choose>
</Project>
Modified text is an extract of the original Stack Overflow Documentation
ライセンスを受けた CC BY-SA 3.0
所属していない Stack Overflow