MSBuild: Selecting first and last items in an ItemGroup
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
<Project DefaultTargets="Default"> | |
<ItemGroup> | |
<Items Include="One;Two;Three;Four;Five" /> | |
</ItemGroup> | |
<Target Name="Default"> | |
<ItemGroup> | |
<Reversed Include="@(Items->Reverse())" /> | |
</ItemGroup> | |
<PropertyGroup> | |
<First>%(Reversed.Identity)</First> | |
<Last>%(Items.Identity)</Last> | |
</PropertyGroup> | |
<Warning Text="First: $(First)" /> | |
<Warning Text="Last: $(Last)" /> | |
</Target> | |
</Project> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment