From b980ee09713975013ee9c5dbab8a470066d145d7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Fi=C5=A1era?= Date: Tue, 19 May 2026 08:32:20 +0000 Subject: [PATCH] Fix WASM CoreCLR VFS content files missing from boot JSON During CoreCLR WASM nested publish, the _WriteBuildWasmBootJsonFile target (added by #125367 with Inputs/Outputs incrementalism) would write the boot JSON without VFS entries (because LinkContentToWwwroot is skipped when WasmBuildingForNestedPublish=true). Then in the outer build, the Inputs/Outputs check would find the stale output and skip regeneration, leaving the final boot JSON without VFS content files. This caused tests relying on content files (like testdataset1.xml) to fail with DirectoryNotFoundException on WASM CoreCLR. Fix: Skip _WriteBuildWasmBootJsonFile and _GenerateBuildWasmBootJson during nested publish. The nested publish doesn't need the build boot JSON (it only returns WasmAssembliesFinal/WasmNativeAsset), and skipping it ensures the outer build writes the correct boot JSON with VFS entries. Fixes #128293 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- .../Microsoft.NET.Sdk.WebAssembly.Browser.targets | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/src/mono/nuget/Microsoft.NET.Sdk.WebAssembly.Pack/build/Microsoft.NET.Sdk.WebAssembly.Browser.targets b/src/mono/nuget/Microsoft.NET.Sdk.WebAssembly.Pack/build/Microsoft.NET.Sdk.WebAssembly.Browser.targets index 2cd9e68f92b974..d462dfad666eb0 100644 --- a/src/mono/nuget/Microsoft.NET.Sdk.WebAssembly.Pack/build/Microsoft.NET.Sdk.WebAssembly.Browser.targets +++ b/src/mono/nuget/Microsoft.NET.Sdk.WebAssembly.Pack/build/Microsoft.NET.Sdk.WebAssembly.Browser.targets @@ -680,9 +680,14 @@ Copyright (c) .NET Foundation. All rights reserved. + config files, extensions, property stamp) are older than the output, the target is skipped. + Skipped during nested publish: the nested publish runs the full Build chain which would + create the boot JSON without VFS entries (LinkContentToWwwroot is skipped). If we wrote + it here, the outer build's Inputs/Outputs check would find the stale output and skip + regeneration, leaving the final boot JSON without VFS content files. --> @@ -733,8 +738,10 @@ Copyright (c) .NET Foundation. All rights reserved. - + This target always runs to ensure items are populated even when _WriteBuildWasmBootJsonFile is skipped. + Skipped during nested publish (same reason as _WriteBuildWasmBootJsonFile). --> +