Migrate GenerateStaticWebAssetsDevelopmentManifest - #54836
Merged
AlesProkop merged 8 commits intoJun 26, 2026
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Migrates GenerateStaticWebAssetsDevelopmentManifest to MSBuild’s multithreaded task model by resolving all file-system paths via TaskEnvironment (instead of relying on the process current directory), and adds regression tests that validate behavior when process CWD differs from the project directory.
Changes:
- Marked the task as
[MSBuildMultiThreadableTask]/IMultiThreadableTaskand introducedTaskEnvironment-rooted path resolution for manifest/cache paths and per-asset resolution. - Updated manifest persistence and change-detection probes to operate on
TaskEnvironment-absolutized paths. - Added tests that mutate process CWD and assert manifests are created/probed relative to the project directory, not the process CWD.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| src/StaticWebAssetsSdk/Tasks/GenerateStaticWebAssetsDevelopmentManifest.cs | Implements multithread-safe path resolution via TaskEnvironment and updates manifest probing/writing to use absolutized paths. |
| test/Microsoft.NET.Sdk.StaticWebAssets.Tests/StaticWebAssets/GenerateStaticWebAssetsDevelopmentManifestMultiThreadingTest.cs | Adds CWD-decoy regression tests ensuring the task resolves and writes manifests relative to TaskEnvironment.ProjectDirectory. |
JanProvaznik
approved these changes
Jun 19, 2026
OvesN
requested changes
Jun 19, 2026
OvesN
reviewed
Jun 19, 2026
OvesN
reviewed
Jun 22, 2026
OvesN
approved these changes
Jun 22, 2026
AlesProkop
enabled auto-merge (squash)
June 23, 2026 06:42
Microsoft.NET.Sdk.StaticWebAssets.Tests was migrated to MSTest.Sdk on main. The new test file still used xUnit [Fact], so after merging main it failed to compile (CS0246: Fact/FactAttribute not found) on every CI Build leg. Convert it to [TestClass]/[TestMethod] with [DoNotParallelize] to match the migrated project. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
5 tasks
…n_ThereAreNoAssetsNorDiscoveryPatterns The multithreaded migration changed Execute() to call TaskEnvironment.GetAbsolutePath(ManifestPath) unconditionally. The test left the [Required] ManifestPath/CacheFilePath unset, so GetAbsolutePath(null) threw ArgumentNullException where File.Exists(null) previously returned false. Provide non-null paths so the no-assets early-out is exercised. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
OvesN
approved these changes
Jun 26, 2026
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#14059
Context
Migrates
GenerateStaticWebAssetsDevelopmentManifestto MSBuild's multithreaded task model. Under multithreaded execution the process current directory is not the project directory, so any path resolved relative to the process CWD is wrong. All file-system paths must be absolutized throughTaskEnvironmentso they root against the project directory.Changes Made
[MSBuildMultiThreadableTask]and implementedIMultiThreadableTask, addingTaskEnvironment TaskEnvironment { get; set; } = TaskEnvironment.Fallback;.ManifestPathandCacheFilePathviaTaskEnvironment.GetAbsolutePath()before the up-to-date check (File.Exists/File.GetLastWriteTimeUtc) and passed the absolutizedAbsolutePathintoPersistManifestforFile.Exists/File.ReadAllBytes/File.WriteAllBytes.TaskEnvironmentintoStaticWebAsset.FromTaskItemGroupso each asset'sContentRoot/RelatedAssetresolves against the project directory.TaskEnvironmentthroughCreateManifestintoResolveSubPathand absolutizedasset.Identityfor theFile.Existsprobe.File.Exists(null/"")==falsesemantics by guarding the up-to-date check with!string.IsNullOrEmpty(ManifestPath)and theResolveSubPathprobe with!string.IsNullOrEmpty(asset.Identity), and preserved the&&short-circuit soCacheFilePathis only absolutized when the manifest exists.Log.LogMessagecalls using the originalManifestPath/asset.Identitystrings (no absolutized paths leak into log output); theStartsWith/Substringsubpath logic still uses the rawasset.Identity, keeping manifest output byte-identical in single-process mode.Testing
Microsoft.NET.Sdk.StaticWebAssets.Tests— 0 warnings, 0 errors.GenerateStaticWebAssetsDevelopmentManifestMultiThreadingTest(decoy-CWD pattern):WritesManifestRelativeToTaskEnvironmentProjectDirectory_NotProcessCurrentDirectory— asserts the manifest is written under the project directory, not the process CWD.ResolvesExistingManifestProbeRelativeToProjectDirectory_NotProcessCurrentDirectory— asserts the change-detection probe targets the project directory and leaves a decoy manifest in the CWD unread and unoverwritten.GenerateStaticWebAssetsDevelopmentManifestsuite (existing + new). Result: 25 passed, 0 failed.