Fix invalid MSBuild ItemGroup syntax in WASM HotReload#52884
Open
Fix invalid MSBuild ItemGroup syntax in WASM HotReload#52884
Conversation
The code was using:
<_WasmHotReloadModule OriginalItemSpec="%(Identity)" />
This creates a new empty item instead of setting metadata on the existing item.
Fixed to use proper MSBuild Update syntax:
<_WasmHotReloadModule Update="@(_WasmHotReloadModule)">
<OriginalItemSpec>%(Identity)</OriginalItemSpec>
</_WasmHotReloadModule>
This issue was introduced in #52816 and could cause DefineStaticWebAssets
to receive empty items, leading to potential build failures or incorrect
static web asset processing.
Contributor
There was a problem hiding this comment.
Pull request overview
Fixes an MSBuild ItemGroup declaration in the WASM SDK Hot Reload wiring so that OriginalItemSpec metadata is applied to the existing _WasmHotReloadModule item (rather than accidentally creating a new, empty item). This aligns with how DefineStaticWebAssets consumes OriginalItemSpec when PropertyOverrides is set.
Changes:
- Replace the invalid “create a new item with metadata” pattern with an MSBuild
Updatepattern. - Ensure
_WasmHotReloadModulehasOriginalItemSpecmetadata set to the item’s identity.
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.
Fixes the invalid MSBuild syntax identified in PR #52879 review comments.
Issue
The original code in #52879 used incorrect MSBuild syntax:
This creates a new empty item instead of updating the existing item's metadata, which could cause
DefineStaticWebAssetsto process phantom assets with empty Identity values.Fix
Changed to the correct MSBuild
Updatepattern:This properly updates the existing item's metadata instead of creating a new item.
Review Feedback
This addresses the feedback from @copilot-pull-request-reviewer in #52879:
#52879 (comment)
Testing
The existing test
Publish_HostingMultipleBlazorWebApps_Worksvalidates this scenario works correctly.Risk
Very low - this is a surgical fix to use correct MSBuild syntax that follows the established pattern used elsewhere in the SDK.