From b5c2e8db18daac4d95e31266f4355ad617dfd50e Mon Sep 17 00:00:00 2001 From: Matt Thalman Date: Wed, 1 Jul 2026 08:30:31 -0500 Subject: [PATCH] Force-build WasmSdk before layout glob to fix dropped WebAssembly SDK 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/sdk#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. --- src/Layout/redist/targets/GenerateLayout.targets | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Layout/redist/targets/GenerateLayout.targets b/src/Layout/redist/targets/GenerateLayout.targets index e8588b4cf395..c226d267d6b5 100644 --- a/src/Layout/redist/targets/GenerateLayout.targets +++ b/src/Layout/redist/targets/GenerateLayout.targets @@ -196,10 +196,10 @@ - + <_SdkProjectFile Include="$(RepoRoot)src\WebSdk\**\*.csproj;$(RepoRoot)src\WasmSdk\**\*.csproj" /> - + $(ArtifactsBinDir)$(Configuration)\Sdks\Microsoft.NET.Sdk