Created
July 28, 2018 18:45
-
-
Save azyobuzin/573cba467fab015e241bc35f5cb126d5 to your computer and use it in GitHub Desktop.
条件に一致する最初の項目を取得しようとしてもうまくいかない例
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="UTF-8"?> | |
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003" | |
DefaultTargets="Build"> | |
<ItemGroup> | |
<FooItem Include="Foo1" Meta="A" /> | |
<FooItem Include="Foo2" Meta="B" /> | |
<FooItem Include="Foo3" Meta="B" /> | |
<FooItem Include="Foo4" Meta="C" /> | |
</ItemGroup> | |
<Target Name="Build"> | |
<PropertyGroup> | |
<!-- $(FirstB) はバッチ実行前の値で評価されるので、これはうまくいかない --> | |
<FirstB Condition="'$(FirstB)' == '' AND '%(FooItem.Meta)' == 'B'">%(FooItem.Identity)</FirstB> | |
</PropertyGroup> | |
<!-- 期待した出力 → Foo2 --> | |
<!-- 実際の出力 → Foo3 --> | |
<Message Text="First: $(FirstB)" /> | |
</Target> | |
</Project> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment