[release/9.0] [Blazor] Fix custom elements JS assets not being included in build output #60858
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.
Fix custom elements JS assets not being included in build output
This update addresses an issue where JS assets providing functionality for the
Microsoft.AspNetCore.Components.CustomElements
package were not correctly built, causing the extension methodRootComponentMappingCollection.RegisterCustomElement()
to throw an exception.Description
The MSBuild logic to include JS assets in the
Microsoft.AspNetCore.Components.CustomElements
package stopped working because the target that adds JS assets started running too late in the build process (after theResolveJSModuleStaticWebAssets
target). Although the reasons for the change in target ordering are unknown, the fix is to explicitly run the target beforeResolveJSModuleStaticWebAssets
.This bug was discovered during the investigation of failures in our automated Blazor E2E tests.
Fixes #60859
Customer Impact
If this bug is left unfixed, calls to
RegisterCustomElement()
will throw an exception, preventing Blazor WebAssembly functionality from working. In a Blazor Web App, this may cause partial or complete loss of app functionality, and in Blazor WebAssembly apps, complete loss of app functionality.However, note that this issue would only affect Blazor apps using the
Microsoft.AspNetCore.Components.CustomElements
package. The primary purpose of the package is to expose Blazor components as custom elements that can be rendered from a JavaScript-based UI library.We don't have any customer data on the bug because a version of the package with the bug has not shipped. Version 9.0.3 would have included the bug, so we're going to skip shipping version 9.0.3 of this package and get this bug fixed for version 9.0.4.
Regression?
Regressed from
Microsoft.AspNetCore.Components.CustomElements
version 9.0.2.Risk
The fix is simple and was applied back in October 2024 on the
main
branch.Verification
Automated E2E tests caught this bug an SDK update PR targeting
main
because thecomponents-e2e
pipeline is a required check inmain
. However, since that pipeline was not required forrelease
branches, this issue slipped through the cracks forrelease/9.0
. This has been fixed, and thecomponents-e2e
pipeline is now a required check forrelease
branches.Packaging Changes Reviewed?