Skip to content

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

Merged
maraf merged 5 commits into
mainfrom
fix/wasm-emit-typescript-incremental
Mar 16, 2026
Merged

maraf merged 5 commits into
mainfrom
fix/wasm-emit-typescript-incremental

Conversation

@maraf

@maraf maraf commented Mar 12, 2026

Copy link
Copy Markdown
Member

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 [email protected]

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
Copy Markdown
Contributor

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

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 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.

@ilonatommy ilonatommy left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

No WBT tests for that?

maraf and others added 2 commits March 13, 2026 11:31
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 <[email protected]>
Extends TypeScriptDefinitionsCopiedToWwwrootOnBuild to perform a second
build when WasmEmitTypeScriptDefinitions is enabled, verifying that the
presence of dotnet.d.ts in wwwroot does not break build incrementality.

Co-authored-by: Copilot <[email protected]>
Copilot AI review requested due to automatic review settings March 14, 2026 19:02

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

Copilot reviewed 2 out of 2 changed files in this pull request and generated no new comments.


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

Copilot AI review requested due to automatic review settings March 16, 2026 08:39

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

Copilot reviewed 2 out of 2 changed files in this pull request and generated no new comments.


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

@maraf
maraf merged commit bb542bd into main Mar 16, 2026
36 checks passed
@maraf
maraf deleted the fix/wasm-emit-typescript-incremental branch March 16, 2026 16:30
@github-actions github-actions Bot locked and limited conversation to collaborators Apr 16, 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 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

3 participants