- 
                Notifications
    You must be signed in to change notification settings 
- Fork 10.5k
[release/9.0] [Blazor] Fix custom elements JS assets not being included in build output #60858
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 our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
          
     Merged
      
      
    Conversation
  
    
      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
    
  
  
    
    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.
Copilot reviewed 1 out of 1 changed files in this pull request and generated no comments.
              
                    wtgodbe
  
              
              approved these changes
              
                  
                    Mar 10, 2025 
                  
              
              
            
            
| Approved over email | 
  This was referenced Jul 21, 2025 
      
      
     Closed
  
      
     Closed
  
  This was referenced Oct 27, 2025 
      
      
     Open
  
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment
  
      Labels
  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.CustomElementspackage 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.CustomElementspackage stopped working because the target that adds JS assets started running too late in the build process (after theResolveJSModuleStaticWebAssetstarget). 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.CustomElementspackage. 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.CustomElementsversion 9.0.2.Risk
The fix is simple and was applied back in October 2024 on the
mainbranch.Verification
Automated E2E tests caught this bug an SDK update PR targeting
mainbecause thecomponents-e2epipeline is a required check inmain. However, since that pipeline was not required forreleasebranches, this issue slipped through the cracks forrelease/9.0. This has been fixed, and thecomponents-e2epipeline is now a required check forreleasebranches.Packaging Changes Reviewed?