Skip to content

Force-build WasmSdk before layout glob to fix dropped WebAssembly SDK#55097

Open
mthalman wants to merge 1 commit into
dotnet:mainfrom
mthalman:main
Open

Force-build WasmSdk before layout glob to fix dropped WebAssembly SDK#55097
mthalman wants to merge 1 commit into
dotnet:mainfrom
mthalman:main

Conversation

@mthalman

@mthalman mthalman commented Jul 1, 2026

Copy link
Copy Markdown
Member

PublishNetSdks in GenerateLayout.targets collects the per-SDK layout content via wildcard globs that are evaluated when the target runs. The Microsoft.NET.Sdk.WebAssembly folder is populated by CopyAdditionalFilesToLayout (AfterTargets="Build") on src/WasmSdk/Tasks/Microsoft.NET.Sdk.WebAssembly.Tasks.csproj. If that project has not finished building when the glob runs, the glob resolves to an empty folder and the entire Microsoft.NET.Sdk.WebAssembly SDK is silently dropped from the layout.

This is the same class of ordering race that #15651 worked around for src/WebSdk by force-building those projects up front, but that workaround never covered the sibling src/WasmSdk directory (added later). Extend the force-build to include src/WasmSdk/**/*.csproj so the WebAssembly layout source folder is guaranteed to be populated before the glob runs.

Diagnosed from the reproducibility pipeline (build-twice-and-diff): one build contained the 9 WebAssembly SDK files and the other did not; the binlogs showed PublishNetSdks copied 0 WebAssembly files in the failing build while CopyAdditionalFilesToLayout still ran completely, confirming an ordering race rather than an incremental/timestamp skip.

PublishNetSdks in GenerateLayout.targets collects the per-SDK layout content
via wildcard globs that are evaluated when the target runs. The
Microsoft.NET.Sdk.WebAssembly folder is populated by CopyAdditionalFilesToLayout
(AfterTargets="Build") on src/WasmSdk/Tasks/Microsoft.NET.Sdk.WebAssembly.Tasks.csproj.
If that project has not finished building when the glob runs, the glob resolves to
an empty folder and the entire Microsoft.NET.Sdk.WebAssembly SDK is silently
dropped from the layout.

This is the same class of ordering race that dotnet#15651 worked around for
src/WebSdk by force-building those projects up front, but that workaround never
covered the sibling src/WasmSdk directory (added later). Extend the force-build to
include src/WasmSdk/**/*.csproj so the WebAssembly layout source folder is
guaranteed to be populated before the glob runs.

Diagnosed from the reproducibility pipeline (build-twice-and-diff): one build
contained the 9 WebAssembly SDK files and the other did not; the binlogs showed
PublishNetSdks copied 0 WebAssembly files in the failing build while
CopyAdditionalFilesToLayout still ran completely, confirming an ordering race
rather than an incremental/timestamp skip.
Copilot AI review requested due to automatic review settings July 1, 2026 13:34

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes a layout-generation ordering race where PublishNetSdks can evaluate wildcard globs before the WebAssembly SDK’s layout content has been produced, causing Microsoft.NET.Sdk.WebAssembly to be silently omitted from the final SDK layout.

Changes:

  • Extend the existing “force-build SDK projects before globbing layout content” step to also build projects under src/WasmSdk/**.
  • Consolidate the WebSdk/WasmSdk force-build project list into a single item (_SdkProjectFile) used by the MSBuild task.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants