[release/11.0.1xx-preview1] Backport #52816#52879
Open
lewing wants to merge 2 commits intorelease/11.0.1xx-preview1from
Open
[release/11.0.1xx-preview1] Backport #52816#52879lewing wants to merge 2 commits intorelease/11.0.1xx-preview1from
lewing wants to merge 2 commits intorelease/11.0.1xx-preview1from
Conversation
Co-authored-by: Marek Fišera <mara@neptuo.com>
Contributor
There was a problem hiding this comment.
Pull request overview
Backport of changes that move the WebAssembly Hot Reload browser artifacts into the WebAssembly SDK layout (instead of an implicit package reference) and updates tests/baselines accordingly.
Changes:
- Update WebAssembly SDK MSBuild targets to source the Hot Reload JS module/DLL from the SDK layout and define it as a static web asset.
- Add packaging/build wiring to include the HotReloadAgent.WebAssembly.Browser outputs into the WebAssembly SDK layout.
- Refresh static web assets test baselines and normalize some test launchSettings values.
Reviewed changes
Copilot reviewed 27 out of 27 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| test/TestAssets/TestProjects/WatchBlazorWasmHosted/blazorhosted/Properties/launchSettings.json | Switch dotnetRunMessages from string to boolean for the test asset profile. |
| test/TestAssets/TestProjects/WatchBlazorWasm/Properties/launchSettings.json | Switch dotnetRunMessages from string to boolean for the test asset profile. |
| test/Microsoft.NET.Sdk.StaticWebAssets.Tests/StaticWebAssetsBaselineFactory.cs | Extend path templatization to recognize WebAssembly SDK paths. |
| test/Microsoft.NET.Sdk.BlazorWebAssembly.Tests/StaticWebAssetsBaselines/StaticWebAssets_Publish_Hosted_Works.Publish.files.json | Update expected publish file list baselines for new Hot Reload asset behavior. |
| test/Microsoft.NET.Sdk.BlazorWebAssembly.Tests/StaticWebAssetsBaselines/StaticWebAssets_Publish_DoesNotIncludeXmlDocumentationFiles_AsAssets.Publish.files.json | Update expected publish file list baselines for new Hot Reload asset behavior. |
| test/Microsoft.NET.Sdk.BlazorWebAssembly.Tests/StaticWebAssetsBaselines/StaticWebAssets_PublishMinimal_Works.Publish.staticwebassets.json | Update minimal publish static web assets baseline for new Hot Reload module placement/assets. |
| test/Microsoft.NET.Sdk.BlazorWebAssembly.Tests/StaticWebAssetsBaselines/StaticWebAssets_PublishMinimal_Works.Publish.files.json | Update minimal publish file list baseline. |
| test/Microsoft.NET.Sdk.BlazorWebAssembly.Tests/StaticWebAssetsBaselines/StaticWebAssets_Build_Hosted_Works.Build.staticwebassets.json | Update hosted build static web assets baseline for new Hot Reload module placement/assets. |
| test/Microsoft.NET.Sdk.BlazorWebAssembly.Tests/StaticWebAssetsBaselines/StaticWebAssets_BuildMinimal_Works.Build.staticwebassets.json | Update minimal build static web assets baseline for new Hot Reload module placement/assets. |
| test/Microsoft.NET.Sdk.BlazorWebAssembly.Tests/StaticWebAssetsBaselines/StaticWebAssets_BuildMinimal_Works.Build.files.json | Update minimal build file list baseline to include new Hot Reload outputs. |
| test/Microsoft.NET.Sdk.BlazorWebAssembly.Tests/StaticWebAssetsBaselines/Publish_DoesNotGenerateManifestJson_IncludesJSModulesOnBlazorBootJsonManifest.Publish.staticwebassets.json | Update publish baseline for JS-module/staticwebassets changes. |
| test/Microsoft.NET.Sdk.BlazorWebAssembly.Tests/StaticWebAssetsBaselines/Publish_DoesNotGenerateManifestJson_IncludesJSModulesOnBlazorBootJsonManifest.Publish.files.json | Update publish file list baseline. |
| test/Microsoft.NET.Sdk.BlazorWebAssembly.Tests/StaticWebAssetsBaselines/JsModules_Hosted_CanCustomizeBlazorInitialization.Publish.files.json | Update hosted JS modules publish file list baseline. |
| test/Microsoft.NET.Sdk.BlazorWebAssembly.Tests/StaticWebAssetsBaselines/JsModules_CanHaveDifferentBuildAndPublishModules.Publish.staticwebassets.json | Update publish static web assets baseline for JS module changes. |
| test/Microsoft.NET.Sdk.BlazorWebAssembly.Tests/StaticWebAssetsBaselines/JsModules_CanHaveDifferentBuildAndPublishModules.Publish.files.json | Update publish file list baseline for JS module changes. |
| test/Microsoft.NET.Sdk.BlazorWebAssembly.Tests/StaticWebAssetsBaselines/JsModules_CanCustomizeBlazorInitialization.Publish.staticwebassets.json | Update publish static web assets baseline for JS module changes. |
| test/Microsoft.NET.Sdk.BlazorWebAssembly.Tests/StaticWebAssetsBaselines/JsModules_CanCustomizeBlazorInitialization.Publish.files.json | Update publish file list baseline for JS module changes. |
| test/Microsoft.NET.Sdk.BlazorWebAssembly.Tests/StaticWebAssetsBaselines/JSModules_ManifestIncludesModuleTargetPaths.Build.staticwebassets.json | Update build static web assets baseline for JS module changes. |
| test/Microsoft.NET.Sdk.BlazorWebAssembly.Tests/StaticWebAssetsBaselines/Build_DoesNotGenerateManifestJson_IncludesJSModulesOnBlazorBootJsonManifest.Build.staticwebassets.json | Update build baseline for JS-module/staticwebassets changes. |
| src/WasmSdk/Tasks/Microsoft.NET.Sdk.WebAssembly.Tasks.csproj | Add project reference + package layout inclusion for HotReloadAgent.WebAssembly.Browser outputs into the WebAssembly SDK. |
| src/WasmSdk/Sdk/Sdk.targets | Add _WasmImplicitlyReferenceHotReload target to copy hot reload JS module to intermediates and define it as a static web asset. |
| src/BuiltInTools/HotReloadAgent.WebAssembly.Browser/Microsoft.DotNet.HotReload.WebAssembly.Browser.csproj | Adjust the HotReload browser agent project to build as a non-Razor SDK project and include wwwroot content in outputs. |
| build/RunTestsOnHelix.sh | Remove adding %DOTNET_ROOT%/.nuget as a NuGet source (now only Testpackages is added). |
| build/RunTestsOnHelix.cmd | Remove adding %DOTNET_ROOT%\\.nuget as a NuGet source (now only Testpackages is added). |
- Fix invalid MSBuild ItemGroup syntax: use Update instead of creating empty item - Update comments in test scripts to reflect actual behavior - Addresses PR review feedback from copilot-pull-request-reviewer
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.
Backport of #52816 to release/11.0.1xx-preview1, based on @maraf's PR #52710.
Customer Issue
When multiple Blazor WASM client projects (e.g., FirstClient and SecondClient) are hosted by a single server project, users encounter a duplicate key error in
FilterStaticWebAssetEndpoints. Both clients define the same HotReload JS module (Microsoft.DotNet.HotReload.WebAssembly.Browser.lib.module.js) as a static web asset with identical Identity values, causing the build to fail.Additionally, the HotReload assembly version could be unpredictable when pulled from NuGet package sources, leading to potential version conflicts between the SDK and the referenced package.
Users cannot easily workaround these issues without modifying their project structure to use a single Blazor WASM client.
Description
This PR fixes both issues by embedding the HotReload functionality directly in the WebAssembly SDK:
hotreload\before being defined as a StaticWebAssetThis follows the established pattern used by JSModules, ScopedCss, and ServiceWorker targets, and @javiercn's guidance: "What we do in other situations with assets like this is to copy them to the intermediate output folder before defining them."
Was this a regression?
Testing
The
Publish_HostingMultipleBlazorWebApps_Workstest now passes and validates the fix.Risk
Low - this follows established patterns used elsewhere in the SDK for similar assets (JSModules, ScopedCss, ServiceWorker), and the change is well-tested. Embedding in the SDK also eliminates version conflicts.