Skip to content

Fix invalid MSBuild ItemGroup syntax in WASM HotReload#52884

Open
lewing wants to merge 1 commit intomainfrom
fix-wasm-hotreload-msbuild-syntax
Open

Fix invalid MSBuild ItemGroup syntax in WASM HotReload#52884
lewing wants to merge 1 commit intomainfrom
fix-wasm-hotreload-msbuild-syntax

Conversation

@lewing
Copy link
Member

@lewing lewing commented Feb 6, 2026

Fixes the invalid MSBuild syntax identified in PR #52879 review comments.

Issue

The original code in #52879 used incorrect MSBuild syntax:

<_WasmHotReloadModule OriginalItemSpec="%(Identity)" />

This creates a new empty item instead of updating the existing item's metadata, which could cause DefineStaticWebAssets to process phantom assets with empty Identity values.

Fix

Changed to the correct MSBuild Update pattern:

<_WasmHotReloadModule Update="@(_WasmHotReloadModule)">
  <OriginalItemSpec>%(Identity)</OriginalItemSpec>
</_WasmHotReloadModule>

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)

<_WasmHotReloadModule OriginalItemSpec="%(Identity)" /> inside the ItemGroup appears to create a new item (with an empty Include) rather than setting metadata on the existing _WasmHotReloadModule item.

Testing

The existing test Publish_HostingMultipleBlazorWebApps_Works validates 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.

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.
Copilot AI review requested due to automatic review settings February 6, 2026 21:02
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 Update pattern.
  • Ensure _WasmHotReloadModule has OriginalItemSpec metadata set to the item’s identity.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant