dotnet / dotnet/msbuild

No error for Item update in target

Open
#2,835 23 comments 6 reactions 0 assignees View on GitHub
Area: BuildCheck Area: Engine Breaking Change BuildCheck Suggestion Feature: Warning Waves
Dominant language
C#
Stars
5.5k
Forks
1.5k
Avg merge
1d 13h
Merged PRs (30d)
133

Description

Ran into this while creating a workaround to patch an existing target (https://github.com/dotnet/cli/issues/6397#issuecomment-347989664) and naively using the item update syntax inside a target to update the link metadata of an item.
However, using the update syntax inside a target seems to update the metadata of all items, which is unexpected.

### Steps to reproduce

Project file
```xml













```

Command line
```
dotnet msbuild
```
### Expected behavior

Error for `Update` syntax not being allowed inside targets

or

```
static item: Item1: SomeMeta=MetaVal1
static item: Item2: SomeMeta=ChangedMetaVal2
static item: Item3: SomeMeta=MetaVal3
runtiime item:Item1: SomeMeta=MetaVal1
runtiime item:Item2: SomeMeta=ChangedMetaVal2
runtiime item:Item3: SomeMeta=MetaVal3
```

### Actual behavior

```
static item: Item1: SomeMeta=MetaVal1
static item: Item2: SomeMeta=ChangedMetaVal2
static item: Item3: SomeMeta=MetaVal3
runtiime item:Item1: SomeMeta=ChangedMetaVal2
runtiime item:Item2: SomeMeta=ChangedMetaVal2
runtiime item:Item3: SomeMeta=ChangedMetaVal2
```

### Environment data
`dotnet msbuild /version` output: tested on 15.5.179.9764 and 15.6.12.27473 .

OS info:

If applicable, version of the tool that invokes MSBuild (Visual Studio, dotnet CLI, etc): macOS 10.13.2, `dotnet` cli

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with the XML project and `dotnet msbuild` command in the report, then compare the documented static item update with the equivalent update inside `CreateRuntimeUpdatedItems`. Review the linked dotnet/cli discussion for context. Done means the runtime update either reports an error or produces the expected per-item metadata instead of applying one value to every item.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp
Domain
build-system
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.