Uh oh!
There was an error while loading. Please reload this page.
[browser] Make WASM framework asset CopyToOutputDirectory configurable - #127286
Conversation
… asset copy Introduce a private MSBuild property _WasmFrameworkCopyToOutputDirectory that switches CopyToOutputDirectory between 'Never' (default) and 'PreserveNewest' for WASM framework/webcil static web assets in Microsoft.NET.Sdk.WebAssembly.Browser.targets. Enable it with 'PreserveNewest' in eng/testing/tests.browser.targets so library tests that run from bin/ without the static web assets middleware can still find the framework files. Fixes the regression from dotnet#126407 tracked in dotnet#127257. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
maraf
commented
Apr 22, 2026
/azp run runtime-wasm |
|
Azure Pipelines successfully started running 1 pipeline(s). |
Tagging subscribers to 'arch-wasm': @lewing, @pavelsavara |
There was a problem hiding this comment.
Pull request overview
This PR addresses a regression in in-tree WASM library tests by making the WebAssembly SDK’s framework/webcil static web asset CopyToOutputDirectory behavior configurable, while keeping the default behavior for typical dotnet run unchanged (assets served from intermediate locations via static web assets).
Changes:
- Introduce a private MSBuild property
_WasmFrameworkCopyToOutputDirectory(defaultNever) and route relevantCopyToOutputDirectoryvalues through it. - Set
_WasmFrameworkCopyToOutputDirectory=PreserveNewestfor browser test builds so framework assets are present underbin/for direct execution.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| src/mono/nuget/Microsoft.NET.Sdk.WebAssembly.Pack/build/Microsoft.NET.Sdk.WebAssembly.Browser.targets | Adds _WasmFrameworkCopyToOutputDirectory and uses it to control whether framework/webcil static web assets are copied to output during build. |
| eng/testing/tests.browser.targets | Forces _WasmFrameworkCopyToOutputDirectory=PreserveNewest for in-tree browser tests that run from bin/ without static web assets middleware. |
Uh oh!
There was an error while loading. Please reload this page.
maraf
commented
Apr 23, 2026
/ba-g Windows variant of library tests passed. Merging to unblock CI |
Note
This PR was created with the assistance of GitHub Copilot.
Summary
Fixes the library-tests regression from #126407 tracked in #127257.
#126407 switched the WASM framework / webcil static web asset
CopyToOutputDirectoryfromPreserveNewesttoNever, which is correct fordotnet run(static web assets middleware serves files out ofobj/fx/). But library tests in this repo run the app directly frombin/without the middleware, so the framework files are missing and loadingdotnet.*.jsfails.Changes
Microsoft.NET.Sdk.WebAssembly.Browser.targets: introduce a private MSBuild property_WasmFrameworkCopyToOutputDirectory(defaultNever) and route the threeCopyToOutputDirectoryvalues through it (Computed/webcil assets, Framework assets, and the post-UpdatePackageStaticWebAssetsitem update).eng/testing/tests.browser.targets: set_WasmFrameworkCopyToOutputDirectorytoPreserveNewestso library tests copy framework assets to the output directory as before.Default behavior for regular
dotnet run/ Blazor WASM scenarios is unchanged.