msbuild
msbuild copied to clipboard
[Built-in analyzer] Item is updated inside a target
Background
This issue tracks one of the BuildCheck analyzers we would like to ship in-box with MSBuild.
Goal
Implement an analyzer with the following rule: No item is attempted to be updated using the Update
attribute inside a target.
Notes
While the Update
attribute can be added to items inside a target, it is ignored and the transformation is applied to all items of the given type. Implementing this analyzer will likely require introducing TaskParameterMessageKind.UpdateItem
to communicate the attempted operation to the analyzer.
This is a mitigation for #2835.
this functionality is not supported inside targets and the engine silently does nothing
Nit: the problem isn't that the engine does nothing, it's that it ignores the Update
attribute, applying the transformation to all items of that type instead of a filtered list.
I have updated the description, thank you!
Related to:
- #2835
- #3538
If the engine instead was updated to honor the attribute, this analysis would not be needed. However, it sounds like that isn't an option.
This is not related to #3538--that's about the update mechanism that has existed ~forever, rather than the Update attribute.
Indeed, honoring the attribute would be a breaking change 😢