Revert "Fix RecursiveDir metadata loss in multithreaded builds"#13245
Merged
JanProvaznik merged 1 commit intomainfrom Feb 12, 2026
Merged
Revert "Fix RecursiveDir metadata loss in multithreaded builds"#13245JanProvaznik merged 1 commit intomainfrom
JanProvaznik merged 1 commit intomainfrom
Conversation
This reverts commit eff1a3b.
MichalPavlik
approved these changes
Feb 12, 2026
JanProvaznik
added a commit
to JanProvaznik/msbuild
that referenced
this pull request
Feb 25, 2026
JanProvaznik
added a commit
to JanProvaznik/msbuild
that referenced
this pull request
Mar 3, 2026
When using MSBuild's -mt mode (/maxcpucount), tasks without [MSBuildMultiThreadableTask] are routed to out-of-process TaskHost sidecars. Items passed to these tasks are serialized via TaskParameterTaskItem, which calls CloneCustomMetadataEscaped() — copying only custom metadata. RecursiveDir is a built-in metadata that is non-derivable (requires _includeBeforeWildcardExpansionEscaped), so it's lost during this serialization, returning empty string on the TaskHost side. This causes dotnet pack /mt to flatten directory structures in NuGet packages (e.g., build/wix/bundle/bundle.wxs becomes build/bundle.wxs). Fix: Explicitly copy RecursiveDir to custom metadata in the TaskParameterTaskItem constructor before serialization, so it survives the cross-process boundary. Unlike the previous attempt (PR dotnet#13142, reverted in PR dotnet#13245), this fix ONLY touches the TaskHost serialization boundary (TaskParameterTaskItem). It does NOT change GatherTaskItemOutputs or ProjectItemInstance, which was what caused the NuGet/sfxproj double-append regression. Items that lose RecursiveDir at the MSBuild task callback boundary (e.g., sfxproj targets returning items via TargetOutputs) are unaffected — they already have RecursiveDir=empty before reaching TaskParameterTaskItem. Fixes dotnet#13140 Related: dotnet#3121 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Reverts #13142
Breaks VMR and possibly other consumers of msbuild.
#3121 it fixes has been so longstanding, that customers have implemented workarounds which would break by fixing it. We should instead document it as a known limitation.
Should be partially reimplemented to address only #13140