[Bug]: MSBuild reads projects multiple times, resulting in different project contents at different points in the build
- Dominant language
- C#
- Stars
- 5.5k
- Forks
- 1.5k
- Avg merge
- 1d 8h
- Merged PRs (30d)
- 141
Description
### Issue Description
When a Project is built on a new Node for the first time its contents are read by that node. This can lead to inconsistent views of the contents of that project between Nodes, because each Node keeps a Node-local cache of project files contents. This can lead users to incorrectly believe that in scenarios where the same project file is read multiple times (like a multi-targeted .NET SDK-style project) the outer build can change project file contents and the inner build will always reflect those changes.
### Steps to Reproduce
* Create a multi-targeted .NET SDK style project
* Make a Target in that project that writes content to the project, and condition the target on an outer-build-only Target.
* Build the project using `/m`
* Investigate the binlog and see the changes between the outer and inner builds
### Expected Behavior
The project files content should be read once over the course of the build and that initial content should be used as the basis for all evaluation and execution.
### Actual Behavior
Each time a Node loads a project for the first time, the file content is read leading to inconsistent views of the project across evaluations and executions on different Nodes.
### Analysis
Fixes here are varied - some kind of central reading/coordination layer would need to be in place, and all XML file reads would need to happen over IPC to that coordination layer.
### Versions & Configurations
_No response_
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.