[browser] Make WASM framework asset CopyToOutputDirectory configurable#127286
Merged
maraf merged 1 commit intodotnet:mainfrom Apr 23, 2026
Merged
[browser] Make WASM framework asset CopyToOutputDirectory configurable#127286maraf merged 1 commit intodotnet:mainfrom
maraf merged 1 commit intodotnet:mainfrom
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>
Member
Author
|
/azp run runtime-wasm |
|
Azure Pipelines successfully started running 1 pipeline(s). |
Contributor
|
Tagging subscribers to 'arch-wasm': @lewing, @pavelsavara |
Contributor
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. |
lewing
approved these changes
Apr 22, 2026
This was referenced Apr 22, 2026
Open
Member
Author
|
/ba-g Windows variant of library tests passed. Merging to unblock CI |
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.
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.