Skip to content

Migrate CopyRefAssembly to multithreaded execution model#84420

Draft
OvesN wants to merge 4 commits into
dotnet:mainfrom
OvesN:dev/veronikao/migrate-CopyRefAssembly-to-mt
Draft

Migrate CopyRefAssembly to multithreaded execution model#84420
OvesN wants to merge 4 commits into
dotnet:mainfrom
OvesN:dev/veronikao/migrate-CopyRefAssembly-to-mt

Conversation

@OvesN

@OvesN OvesN commented Jul 7, 2026

Copy link
Copy Markdown

Fixes dotnet/msbuild#14258
Migrates the CopyRefAssembly task to MSBuild's multithreaded execution model.

What: Implements IMultiThreadableTask and marks the task [MSBuildMultiThreadableTask]. SourcePath / DestinationPath are absolutized against the task's ProjectDirectory (via TaskEnvironment) instead of the process-wide current working directory.

Why: In multithreaded MSBuild mode, tasks share a single process, so depending on the process current directory is unsafe. Resolving paths against ProjectDirectory keeps the task correct when instances run concurrently. Log output still shows the original relative paths, and null/empty inputs keep their existing "file missing"/error behavior (the migration guards GetAbsolutePath with string.IsNullOrEmpty).

Note

The Microsoft.Build 18.6.3 version bump included in this branch comes from #84343. This PR is stacked on that change and should be merged after it.

Microsoft Reviewers: Open in CodeFlow

JanProvaznik and others added 3 commits July 1, 2026 15:28
Moves all three Microsoft.Build central groups (source-build, net10.0, net472)
to 18.6.3. Unlike 18.4.0, 18.6.3's dependency closure requires System.* at
10.0.3+, so align the transitively-pulled System.* packages to the 10.0.8 band
already used by the core flowed System.* packages (System.Collections.Immutable,
System.Text.Json, etc.):

- Hand-maintained literals: System.CodeDom (Packages.props),
  System.Security.Cryptography.Pkcs/Xml (Versions.props, both groups).
- darc-flowed peripherals (only pulled transitively via MSBuild, so they lagged
  at 10.0.1): System.Configuration.ConfigurationManager, System.Diagnostics.EventLog,
  System.Security.Cryptography.ProtectedData, System.Resources.Extensions
  (Version.Details.xml + Version.Details.props).

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…for 18.6.3

Annotate the task with [MSBuildMultiThreadableTask] so it can run in-process
under MSBuild's multithreaded execution model. Its Execute() only logs a message,
so the attribute alone is sufficient; it does not need IMultiThreadableTask or
TaskEnvironment. All build flavors reference 18.6.3, so the attribute is applied
unconditionally.

Also update ErrorLoggingEngine: the internal Microsoft.Build.Shared.EventArgsFormatting
helper it reflects into moved from Microsoft.Build.dll to Microsoft.Build.Framework.dll
in MSBuild 18.6+, so load it from Microsoft.Build.Framework.dll.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@dotnet-policy-service dotnet-policy-service Bot added the Community The pull request was submitted by a contributor who is not a Microsoft employee. label Jul 7, 2026
Implement IMultiThreadableTask and resolve SourcePath/DestinationPath against the task's ProjectDirectory (via TaskEnvironment) instead of the process-wide current directory, so the task is safe to run concurrently in MSBuild's multithreaded mode. Log output keeps the original relative paths.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@OvesN
OvesN force-pushed the dev/veronikao/migrate-CopyRefAssembly-to-mt branch from 88b9ea3 to 06db787 Compare July 7, 2026 08:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Community The pull request was submitted by a contributor who is not a Microsoft employee.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Multithreaded] Migrate CopyRefAssembly in Roslyn

2 participants