Skip to content

[browser] Review concatenation logic in WebAssembly SDK - #127552

Merged
maraf merged 2 commits into
dotnet:mainfrom
maraf:maraf/fix-wasm-sdk-path-concatenation
May 8, 2026
Merged

maraf merged 2 commits into
dotnet:mainfrom
maraf:maraf/fix-wasm-sdk-path-concatenation

Conversation

@maraf

@maraf maraf commented Apr 29, 2026

Copy link
Copy Markdown
Member

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

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

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.

@maraf
maraf merged commit 2fc2cf9 into dotnet:main May 8, 2026
47 checks passed
@maraf
maraf deleted the maraf/fix-wasm-sdk-path-concatenation branch May 8, 2026 09:55
jakobbotsch pushed a commit to jakobbotsch/runtime that referenced this pull request May 12, 2026
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@github-actions github-actions Bot locked and limited conversation to collaborators Jun 8, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

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

5 participants