Skip to content

[browser] Review concatenation logic in WebAssembly SDK#127552

Open
maraf wants to merge 1 commit intodotnet:mainfrom
maraf:maraf/fix-wasm-sdk-path-concatenation
Open

[browser] Review concatenation logic in WebAssembly SDK#127552
maraf wants to merge 1 commit intodotnet:mainfrom
maraf:maraf/fix-wasm-sdk-path-concatenation

Conversation

@maraf
Copy link
Copy Markdown
Member

@maraf maraf commented Apr 29, 2026

Note

This PR was AI/Copilot-generated.

Replace string concatenation of directory properties with proper MSBuild path functions in Microsoft.NET.Sdk.WebAssembly.Browser.targets:

  • $(IntermediateOutputPath)$(_WasmBootConfigFileName)$([MSBuild]::NormalizePath(...))
  • $(PublishDir)wwwroot$([MSBuild]::NormalizeDirectory($(PublishDir), 'wwwroot'))

This ensures paths are correctly combined regardless of whether the directory properties have trailing separators.

Fixes #103783

Replace string concatenation of directory properties with proper MSBuild
path functions:
- +filename → $([MSBuild]::NormalizePath(...))
- +wwwroot → $([MSBuild]::NormalizeDirectory(...))

This ensures paths are correctly combined regardless of whether the
directory properties have trailing separators.

Fixes dotnet#103783

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings April 29, 2026 09:06
Copy link
Copy Markdown
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

This PR updates the WebAssembly Browser SDK targets to avoid fragile path concatenation and instead use MSBuild’s built-in path normalization helpers, making path construction resilient to whether input directory properties include trailing separators.

Changes:

  • Replace $(IntermediateOutputPath)$(_WasmBootConfigFileName) / $(IntermediateOutputPath)$(_WasmPublishBootConfigFileName) concatenations with $([MSBuild]::NormalizePath(...)).
  • Replace $(PublishDir)wwwroot concatenations with $([MSBuild]::NormalizeDirectory($(PublishDir), 'wwwroot')) for Static Web Assets ContentRoot.

@maraf maraf marked this pull request as ready for review April 29, 2026 09:43
@maraf maraf requested review from a team and ilonatommy April 29, 2026 09:43
@pavelsavara pavelsavara added the arch-wasm WebAssembly architecture label Apr 29, 2026
@dotnet-policy-service
Copy link
Copy Markdown
Contributor

Tagging subscribers to 'arch-wasm': @lewing, @pavelsavara
See info in area-owners.md if you want to be subscribed.

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

Labels

arch-wasm WebAssembly architecture area-Build-mono

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Review contatenation logic in the Wasm SDK

4 participants