- Notifications
You must be signed in to change notification settings - Fork5.2k
[browser] Use WebAssembly SDK for runtime tests#120330
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
base:main
Are you sure you want to change the base?
Conversation
This comment was marked as resolved.
This comment was marked as resolved.
There was a problem hiding this comment.
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 migrates WebAssembly runtime tests from using the legacyWasmAppBuilder task to the WebAssembly SDK. This is a significant infrastructure change that modernizes the build pipeline and removes technical debt.
Key changes:
- Removes
WasmAppBuildertask and related targets (522 lines deleted from WasmAppBuilder.cs) - Introduces
LinkContentToWwwroottask to transform content items for StaticWebAssets SDK compatibility - Changes output directory from
AppBundletowwwrootfor browser targets - Updates SDK integration with proper props/targets imports from Microsoft.NET.Sdk.WebAssembly
- Migrates AOT & EAT smoke tests from Helix to Azure DevOps
- Removes
minimal-configsample (replaced by proper SDK support)
Reviewed changes
Copilot reviewed 59 out of 82 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
src/tests/build.proj | Parameterizes mobile app bundle directory name to supportwwwroot for browser |
src/tests/Common/helixpublishwitharcade.proj | Updates all references from hardcodedAppBundle to useMobileAppBundleDirName |
src/tests/FunctionalTests/WebAssembly/Directory.Build.props | ConvertsWasmExtraFilesToDeploy toContent items withLink metadata |
src/tasks/WasmBuildTasks/LinkContentToWwwroot.cs | New task that handles content transformation for StaticWebAssets SDK |
src/tasks/WasmAppBuilder/WasmAppBuilder.cs | Deleted - replaced by WebAssembly SDK |
src/tasks/Microsoft.NET.Sdk.WebAssembly.Pack.Tasks/GenerateWasmBootJson.cs | Adds path normalization for VFS resources |
src/tasks/Microsoft.NET.Sdk.WebAssembly.Pack.Tasks/ComputeWasmBuildAssets.cs | Adds duplicate file name detection |
src/mono/wasm/build/WasmApp.LocalBuild.props | Configures WebAssembly SDK paths for in-tree builds |
src/mono/wasm/build/WasmApp.Common.targets | FixesWasmRunWasmOpt path handling |
src/mono/sample/wasm/* | Multiple samples updated to removeWasmExtraFilesToDeploy and use wwwroot |
src/mono/sample/wasm/browser-minimal-config/* | Entire sample removed (SDK now supports this scenario) |
src/mono/nuget/Microsoft.NET.Sdk.WebAssembly.Pack/build/Microsoft.NET.Sdk.WebAssembly.Browser.targets | Major refactoring of VFS and asset handling |
src/libraries/*/tests/*.csproj | Library tests updated to useContent withLink instead ofWasmExtraFilesToDeploy |
eng/testing/tests.wasm.targets | Updates for wwwroot and removes unusedWasmGenerateAppBundle property |
eng/testing/tests.browser.targets | Significant refactoring for SDK integration and content linking |
eng/testing/linker/trimmingTests.targets | Updates paths fromAppBundle topublish/wwwroot |
eng/pipelines/runtime.yml | DisablesbuildAOTOnHelix for EAT and Smoke tests |
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
src/tasks/Microsoft.NET.Sdk.WebAssembly.Pack.Tasks/GenerateWasmBootJson.csShow resolvedHide resolved
Uh oh!
There was an error while loading.Please reload this page.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
ilonatommy left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Initial pass: I'm 50% done 😉
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
ilonatommy left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Approved for me but I think more people should read it.
| continue; | ||
| } | ||
| Log.LogMessage(MessageImportance.Low,$"Skipping item with Identity '{identity}' (TargetPath '{targetPath}', Link '{link}') because CopyToOutputDirectory is not 'PreserveNewest' or 'Always' ('{copyPreserveOrAlways}')."); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Nit: could we change the order? First checkif(!copyPreserveOrAlways) -> log skip message +continue.
Could you also confirm that the current behavior is expected:
If we have item with target path with link that iswwwroot, then we will log "Skipping item with Identity .. because CopyToOutputDirectory is not 'PreserveNewest' or 'Always' ".
This does not look intentional. Maybe using if-else-else would help.
| <_MonoAotCrossCompilerPath>$([MSBuild]::NormalizePath($(MonoArtifactsPath), 'cross', '$(TargetOS)-$(TargetArchitecture.ToLowerInvariant())', 'mono-aot-cross'))</_MonoAotCrossCompilerPath> | ||
| <_MonoAotCrossCompilerPathCondition="$([MSBuild]::IsOSPlatform('WINDOWS'))">$(_MonoAotCrossCompilerPath).exe</_MonoAotCrossCompilerPath> | ||
| <_WebAssemblyPropsFileCondition="'$(_WebAssemblyPropsFile)' == ''">$(RuntimeSrcDir)\mono\nuget\Microsoft.NET.Sdk.WebAssembly.Pack\build\Microsoft.NET.Sdk.WebAssembly.Browser.props</_WebAssemblyPropsFile> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Maybe it should be blamed on git diff view but I don't see this property used, only definitions.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
We can revert all changes in LocalBuild targets, it's the feature for AOT on Helix, which doesn't work
pavelsavara commentedNov 28, 2025
/azp run runtime-wasm |
| Azure Pipelines successfully started running 1 pipeline(s). |
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
| <WasmXHarnessArgs>$(WasmXHarnessArgs) --web-server-middleware=$(_RemoteLoopMiddleware)/RemoteLoopServer.dll,RemoteLoopServer.GenericHandler</WasmXHarnessArgs> | ||
| <WasmXHarnessArgs>$(WasmXHarnessArgs) --web-server-middleware=$(_TestEchoMiddleware)/NetCoreServer.dll,NetCoreServer.GenericHandler</WasmXHarnessArgs> | ||
| <!-- Pass '_TargetFrameworkForXHarness' when StaticWebAssetsSDK is processing NetCoreServer and RemoteLoopServer reference--> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
NetCoreServer.dll needs to be on the server side only. Why does it impact StaticWebAssets ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
StaticWebAssetsSDK is looking if any referenced project contains StaticWebAssets. StaticWebAssets is a server-side feature.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
I mean, NetCoreServer doesn't expose any static assets, it's a HTTP server plugin. So it should not influence content of wwwroot at all, nor end up in VFS.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Yes, but StaticWebAssetsSDK doesn't know it. It just probes all ProjectReferences. If we don't pass the TFM property, the nested msbuild invocation by StaticWebAssetsSDK won't work correctly.
Yes, it doesn't do anything in this case. Anyway StaticWebAssetsSDK needs to check
Uh oh!
There was an error while loading.Please reload this page.
...nuget/Microsoft.NET.Sdk.WebAssembly.Pack/build/Microsoft.NET.Sdk.WebAssembly.Browser.targetsShow resolvedHide resolved
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
| <linkrel="preload"href="./dotnet.boot.js"as="fetch"crossorigin="use-credentials"> | ||
| <linkrel="prefetch"href="./dotnet.native.js"as="fetch"crossorigin="anonymous"> | ||
| <linkrel="prefetch"href="./dotnet.runtime.js"as="fetch"crossorigin="anonymous"> | ||
| <scripttype='module'src="./_framework/dotnet.js"></script> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
@radekdoulik does this PR break any of the benchmark infra you have ?
pavelsavara left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
LGTM, few nits. Thank you for doing this!
maraf commentedNov 29, 2025
/azp run runtime-wasm |
| Azure Pipelines successfully started running 1 pipeline(s). |
maraf commentedNov 29, 2025
/azp run runtime-wasm |
| Azure Pipelines successfully started running 1 pipeline(s). |
Uh oh!
There was an error while loading.Please reload this page.
WasmAppBuilderand targets around itminimal-configsample as we have a proper way to generate bundler-friendly boot configLinkContentToWwwroottask to manipulate incoming@(Content)and$(PublishDir)files to the shape that can be consumed by SWA and accessible at some URL (in the wwwroot)WasmInvariantGlobalizationWasmRunWasmOptFixes to#103025
TODO
<Content Link="..."copy the assembly to the publish output early enough, so that it gets picked up toWasmAssembliesToBundleand so the AOT compiler gets itNetCoreServerandRemoteLoopServerGetCurrentProjectBuildStaticWebAssetItemsWasmFilesToIncludeInFileSystem- We needed coreVfs for runtimeConfig, but we have that solved now by embedding it into the boot manifest. I think we can drop coreVfs. The challenge is that VFS items hastargetPathas well, so SWA standard properties aren't enoughIncludeSatelliteAssembliesInVFS(it's not used anywhere anymore)browser-wasm linux Release LibraryTests_EAT(aka AOTonHelix)RunSmokeTestsOnly=trueRunHighAOTResourceRequiringTestsOnly=trueProxyProjectForAOTOnHelix.projis usingWasmApp.LocalBuild.props/targetsPrepareForRun(DependsOn) for SWAComputeAndCopyFilesToPublishDirectoryfor SWAWasmAppDir<OutputType Condition="'$(OutputType)' == ''">exe</OutputType>inMicrosoft.NET.Sdk.WebAssembly.Browser.propsis too relaxed as at the point the default value oflibraryis already supplied by general SDK propsStartupHookForFunctionalTest.csprojWasm.Advanced.Sample.csprojhasWasmAssembliesToBundleitem is emptyStartupHookForFunctionalTestconflicting SWAMicrosoft.CSharp.wasmInvariantGlobalizationis empty, results in_WasmInvariantGlobalization=trueWasmIncludeFullIcuDataWasmAppBuilderand related targetsWasmExtraFilesToDeployfrom tests<WasmEnvironmentVariable Include="DOTNET_DiagnosticPorts" Value="$(DiagnosticPorts)" Condition="'$(DiagnosticPorts)' != ''"/>