Update and Remove don't respect item transforms at evaluation time; they apply to all items instead of just the ones that were selected by the item transform.
This was the case for Update for a long time; Remove was working correctly until #5350.
Project file
<Project>
<ItemGroup>
<Foo Include="C:\*" />
<Foo Include="x" />
<!-- <Foo Update="@(Foo->WithMetadataValue('Filename', 'x'))" Bar="Baz" /> -->
<Foo Remove="@(Foo->WithMetadataValue('Filename', 'x'))" />
</ItemGroup>
<Target Name="Go">
<Message Importance="High"
Text="Foo=@(Foo->'%(Filename) %(Bar)')" />
</Target>
</Project>
Only the x item removed/updated
Go:
Foo=
msbuild /version output: 16.7.0-preview-20309-02+d6862eb21
Thanks for chasing this down @safern!
Most helpful comment
Thanks for chasing this down @safern!