Skip to content

[browser] Fix WasmEmitTypeScriptDefinitions making builds non-incremental#125509

Open
maraf wants to merge 1 commit intomainfrom
fix/wasm-emit-typescript-incremental
Open

[browser] Fix WasmEmitTypeScriptDefinitions making builds non-incremental#125509
maraf wants to merge 1 commit intomainfrom
fix/wasm-emit-typescript-incremental

Conversation

@maraf
Copy link
Member

@maraf maraf commented Mar 12, 2026

When WasmEmitTypeScriptDefinitions is enabled, the _EnsureDotnetTypeScriptDefinitions target copies dotnet.d.ts to wwwroot/ during the first build. On the second build, the evaluation-time wwwroot glob picks up the file as a Content item, causing Static Web Assets to regenerate manifests with different content. The newer obj/ manifests then make _CopyOutOfDateSourceItemsToOutputDirectory treat the build as non-incremental.

Fix by removing wwwroot/dotnet.d.ts from Content at evaluation time (static ItemGroup) so the SWA pipeline never discovers it through the glob, keeping manifests stable across builds.

Fixes #124729

Co-authored-by: Copilot 223556219+Copilot@users.noreply.github.com

When WasmEmitTypeScriptDefinitions is enabled, the _EnsureDotnetTypeScriptDefinitions
target copies dotnet.d.ts to wwwroot/ during the first build. On the second build, the
evaluation-time wwwroot glob picks up the file as a Content item, causing Static Web
Assets to regenerate manifests with different content. The newer obj/ manifests then make
_CopyOutOfDateSourceItemsToOutputDirectory treat the build as non-incremental.

Fix by removing wwwroot/dotnet.d.ts from Content at evaluation time (static ItemGroup)
so the SWA pipeline never discovers it through the glob, keeping manifests stable across
builds.

Fixes #124729

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings March 12, 2026 21:06
@maraf maraf self-assigned this Mar 12, 2026
@maraf maraf added arch-wasm WebAssembly architecture area-Build-mono os-browser Browser variant of arch-wasm and removed area-Build-mono labels Mar 12, 2026
@maraf maraf added this to the 11.0.0 milestone Mar 12, 2026
@maraf maraf requested a review from ilonatommy March 12, 2026 21:08
@dotnet-policy-service
Copy link
Contributor

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

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

This PR fixes a build incrementality regression caused by WasmEmitTypeScriptDefinitions. When enabled, the first build copies dotnet.d.ts to wwwroot/, but on subsequent builds the wwwroot Content glob discovers it, causing Static Web Assets to regenerate manifests and break incrementality. The fix removes wwwroot\dotnet.d.ts from Content at evaluation time.

Changes:

  • Added a static ItemGroup that removes wwwroot\dotnet.d.ts from Content when WasmEmitTypeScriptDefinitions is enabled, preventing the SWA pipeline from discovering it via the glob.

You can also share your feedback on Copilot code review. Take the survey.

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 os-browser Browser variant of arch-wasm

Projects

None yet

Development

Successfully merging this pull request may close these issues.

WasmEmitTypeScriptDefinitions makes builds non-incremental

2 participants