Migrate ComputeReferenceStaticWebAssetItems - #54792
Merged
AlesProkop merged 5 commits intoJun 22, 2026
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR migrates ComputeReferenceStaticWebAssetItems to be safe for MSBuild multi-threaded task execution by eliminating reliance on process current-directory (CWD) for path resolution, aligning with the TaskEnvironment-based execution model.
Changes:
- Marked
ComputeReferenceStaticWebAssetItemsas[MSBuildMultiThreadableTask], implementedIMultiThreadableTask, and threadedTaskEnvironmentinto asset loading and path absolutization. - Added a
TaskEnvironmentoverload toStaticWebAsset.AssetsByTargetPath(...)and updated normalization to canonicalize viaTaskEnvironment-based absolute paths. - Added a regression test ensuring
OriginalItemSpecis resolved against the injected project directory (not the process CWD).
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| test/Microsoft.NET.Sdk.StaticWebAssets.Tests/StaticWebAssets/ComputeReferenceStaticWebAssetItemsTest.cs | Adds regression coverage for OriginalItemSpec absolutization using an injected TaskEnvironment project directory. |
| src/StaticWebAssetsSdk/Tasks/Data/StaticWebAsset.cs | Introduces AssetsByTargetPath(..., TaskEnvironment) overload and ensures item hydration/normalization can be rooted in TaskEnvironment. |
| src/StaticWebAssetsSdk/Tasks/ComputeReferenceStaticWebAssetItems.cs | Makes the task multi-threadable and uses TaskEnvironment for MT-safe asset parsing and OriginalItemSpec absolutization. |
Member
Author
|
Expert MSBuild multithreaded task migration review: no high-confidence actionable issues found. Checked:
|
jankratochvilcz
requested changes
Jun 17, 2026
jankratochvilcz
left a comment
Contributor
There was a problem hiding this comment.
Thanks, one bigger question here :-)
jankratochvilcz
approved these changes
Jun 18, 2026
AlesProkop
enabled auto-merge (squash)
June 18, 2026 10:31
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.
Fixes dotnet/msbuild#14055
Context
Migrates
ComputeReferenceStaticWebAssetItemsto support MSBuild multithreaded task execution by avoiding process-CWD-based path resolution.Changes Made
[MSBuildMultiThreadableTask]toComputeReferenceStaticWebAssetItems.IMultiThreadableTaskand added aTaskEnvironmentproperty withTaskEnvironment.Fallbackdefault.ComputeReferenceStaticWebAssetItemsto passTaskEnvironmentwhen loading static web assets.TaskEnvironmentoverload forStaticWebAsset.AssetsByTargetPath(...), preserving the existing overload viaTaskEnvironment.Fallback.MakeReferencedAssetOriginalItemSpecAbsolutepath resolution to useTaskEnvironment.GetAbsolutePath(...)beforePath.GetFullPath(...), preserving canonicalization while resolving relative paths against the project directory.OriginalItemSpecis absolutized against the injected project directory rather than the process current directory.Testing
src\StaticWebAssetsSdk\Tasks\Microsoft.NET.Sdk.StaticWebAssets.Tasks.csprojsuccessfully.test\Microsoft.NET.Sdk.StaticWebAssets.Tests\Microsoft.NET.Sdk.StaticWebAssets.Tests.csprojfornet11.0successfully.Microsoft.NET.Sdk.StaticWebAssets.Tests.ComputeReferenceStaticWebAssetItemsTestsuccessfully.