dotnet / dotnet/msbuild

[Bug]: Chained item function isn't respected in item update statement

Open
#9,636 7 comments 1 reaction 0 assignees View on GitHub
Area: Language backlog bug Priority:3 triaged
Dominant language
C#
Stars
5.5k
Forks
1.5k
Avg merge
1d 8h
Merged PRs (30d)
141

Description

### Issue Description

Apparently, msbuild ignores chained `->WithMetadataValue('...', '...')` item functions in an item update statement.

### Steps to Reproduce

```xml


Exe
net8.0
enable
enable




<_asdf Include="@(KnownFrameworkReference->WithMetadataValue('Identity', 'Microsoft.NETCore.App')->WithMetadataValue('TargetFramework', 'net8.0'))" />

```

`dotnet build /bl`
Open binary log and search for `KnownFrameworkReference`. Observe that the RuntimePackRuntimeIdentifier metdata is updated on all "Microsoft.NETCore.App" items, not just the one with the "TargetFramework=net8.0" metadata.

The same works with an Include statement. Search for `_asdf` and observe that only one item is listed.

### Expected Behavior

Only one item should be updated instead of all the ones with Identity=Microsoft.NETCore.App.

### Actual Behavior

All Identity="Microsoft.NETCore.App" KnownFrameworkReference items get updated, regardless of the TargetFramework metdata on the item.

### Analysis

_No response_

### Versions & Configurations

_No response_

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.