Skip to content

[browser] Override boot config only when the content changes#118637

Merged
maraf merged 7 commits into
mainfrom
maraf/BrowserArtifactWriter
Aug 13, 2025
Merged

[browser] Override boot config only when the content changes#118637
maraf merged 7 commits into
mainfrom
maraf/BrowserArtifactWriter

Conversation

@maraf

@maraf maraf commented Aug 12, 2025

Copy link
Copy Markdown
Member
  • Include ArtifactWriter in Wasm SDK tasks.
  • Use it when generating boot config to skip file write if the file is the same
PS samples WasmBuildBootIncremental> dotnet build .\BlazorWasm\ -bl -question
Restore complete (0.4s)
    info NETSDK1057: You are using a preview version of .NET. See: https://aka.ms/dotnet-support-policy
  BlazorWasm succeeded (1.3s) → BlazorWasm\bin\Debug\net10.0\wwwroot

Build succeeded in 2.2s

Fixes dotnet/aspnetcore#63207

@maraf maraf added this to the 10.0.0 milestone Aug 12, 2025
@maraf maraf self-assigned this Aug 12, 2025
@maraf maraf added arch-wasm WebAssembly architecture area-Build-mono os-browser Browser variant of arch-wasm labels Aug 12, 2025
@maraf maraf marked this pull request as ready for review August 13, 2025 12:43
Copilot AI review requested due to automatic review settings August 13, 2025 12:43
@maraf maraf requested a review from akoeplinger as a code owner August 13, 2025 12:43
@maraf maraf requested a review from a team August 13, 2025 12:43

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 optimizes WebAssembly build performance by preventing unnecessary file writes to the boot configuration. It includes the ArtifactWriter utility from the .NET SDK and uses it to only write the boot config file when its content has actually changed, enabling incremental builds in Blazor WebAssembly projects.

Key changes:

  • Include ArtifactWriter utility class in the WASM app builder tasks
  • Replace direct file write with hash-based change detection for boot config generation

Reviewed Changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

File Description
WasmAppBuilder.csproj Adds reference to ArtifactWriter.cs for build optimization
BootJsonBuilderHelper.cs Replaces File.WriteAllText with ArtifactWriter.PersistFileIfChanged
ArtifactWriter.cs New utility class that compares file hashes to avoid unnecessary writes

@maraf maraf merged commit 8cc92aa into main Aug 13, 2025
29 checks passed
@maraf maraf deleted the maraf/BrowserArtifactWriter branch August 13, 2025 14:20
@github-actions github-actions Bot locked and limited conversation to collaborators Sep 13, 2025
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 os-browser Browser variant of arch-wasm

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[dotnet.js] is not incremental

3 participants