[wasm] Don't import the Mono wasm props on the CoreCLR path - #131420
Open
lewing wants to merge 2 commits into
Open
[wasm] Don't import the Mono wasm props on the CoreCLR path#131420lewing wants to merge 2 commits into
lewing wants to merge 2 commits into
Conversation
The workload pack's Sdk.targets imported BrowserWasmApp.props (and through it WasmApp.Common.props) unconditionally, so the CoreCLR flavor picked up Mono's WasmNestedPublishAppDependsOn=_WasmBuildAppCore even though WasmApp.Common.targets, which defines that target, is never imported on the CoreCLR path. Publishing a CoreCLR browser-wasm app therefore failed with: MSB4057: The target "_WasmBuildAppCore" does not exist in the project. Add BrowserWasmApp.CoreCLR.props with just the flavor-neutral properties (TargetOS/TargetArchitecture/RuntimeIdentifier) and import the props/targets pair per flavor, mirroring what the in-tree WasmApp.InTree.props/targets already do. The Mono files are untouched. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: b49e36e8-8a37-48ef-b7e8-54ac6443ea19
|
Azure Pipelines: Successfully started running 3 pipeline(s). 13 pipeline(s) were filtered out due to trigger conditions. There may be pipelines that require an authorized user to comment /azp run to run. |
Member
Author
|
@maraf this? |
Contributor
There was a problem hiding this comment.
Pull request overview
This PR fixes the packaged Microsoft.NET.Runtime.WebAssembly.Sdk import chain for the experimental CoreCLR browser-wasm flavor by ensuring it imports a matched props+targets pair per runtime flavor, avoiding Mono-only property defaults leaking into the CoreCLR targets graph.
Changes:
- Make the packaged SDK’s
Sdk.targetstemplate importBrowserWasmApp.propsonly for Mono (UseMonoRuntime != false), and import a newBrowserWasmApp.CoreCLR.propsfor CoreCLR (UseMonoRuntime == false). - Add
BrowserWasmApp.CoreCLR.propscontaining only the minimal flavor-neutral properties needed by the CoreCLR path. - Include the new
.propsfile in the SDK NuGet package layout.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| src/mono/nuget/Microsoft.NET.Runtime.WebAssembly.Sdk/Sdk/Sdk.targets.in | Splits imports so Mono and CoreCLR each get a consistent props+targets pair. |
| src/mono/nuget/Microsoft.NET.Runtime.WebAssembly.Sdk/Microsoft.NET.Runtime.WebAssembly.Sdk.pkgproj | Packages the new CoreCLR props file into the SDK’s Sdk/ directory. |
| src/mono/browser/build/BrowserWasmApp.CoreCLR.props | New CoreCLR-specific props file providing TargetOS, TargetArchitecture, and RuntimeIdentifier without Mono-only target list defaults. |
Contributor
|
Tagging subscribers to 'arch-wasm': @lewing, @pavelsavara |
maraf
reviewed
Jul 27, 2026
Per review feedback, none of the three properties are needed: - RuntimeIdentifier is set by the WebAssembly SDK (WasmSdk/Sdk/Sdk.props and Microsoft.NET.Sdk.WebAssembly.Pack.props), both before this Sdk.targets runs. - TargetOS/TargetArchitecture are only consumed in-tree (eng/native.wasm.targets); eng/OSArch.props already derives both from RuntimeIdentifier == 'browser-wasm', which is why in-tree CoreCLR works today without importing BrowserWasmApp.props. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: b49e36e8-8a37-48ef-b7e8-54ac6443ea19
lewing
marked this pull request as ready for review
July 27, 2026 18:15
|
Azure Pipelines: Successfully started running 3 pipeline(s). 13 pipeline(s) were filtered out due to trigger conditions. There may be pipelines that require an authorized user to comment /azp run to run. |
Member
Author
|
@maraf even better? |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Alternative to #131372, following @maraf's review feedback there: keep the CoreCLR wasm targets a standalone set instead of conditioning the shared Mono props.
Problem
Publishing a browser-wasm app with the experimental CoreCLR wasm SDK fails with:
Microsoft.NET.Runtime.WebAssembly.Sdk/Sdk/Sdk.targets.inimportedBrowserWasmApp.propsunconditionally (and through itWasmApp.Common.props), then picked the targets file per flavor. So the CoreCLR path inherited Mono'sWasmNestedPublishAppDependsOn=_WasmBuildAppCore, a target defined inWasmApp.Common.targets, which the CoreCLR path never imports.Fix
Condition the
BrowserWasmApp.propsimport on Mono, matching the existing per-flavor targets split:CoreCLR needs no props counterpart:
RuntimeIdentifieris set by WasmSdk/Sdk/Sdk.props and by ourMicrosoft.NET.Sdk.WebAssembly.Pack.props, both before thisSdk.targetsruns.TargetOS/TargetArchitectureare only consumed in-tree (eng/native.wasm.targets), whereeng/OSArch.propsalready derives both fromRuntimeIdentifier == 'browser-wasm'. That is why in-tree CoreCLR works today without ever importingBrowserWasmApp.props.The Mono files are untouched.
Validation
Staged a replica of the packaged SDK layout (generated
Sdk.targetsfrom the template plus the Sdk-dir files) and ran msbuild against it:UseMonoRuntime=falseRID=browser-wasm IsBrowserWasmProject=true TargetsBrowser=true, Mono depends-on lists emptyUseMonoRuntime=true_WasmBuildAppCorein both lists,WasmAppRuntimeFlavor=MonoUseMonoRuntimeunsetWasmNestedPublishAppfor CoreCLR, before the changeMSB4057aboveResolveRuntimePackAssets->Publish->_GatherWasmFilesToPublish-> CoreCLR targetsThe last pair also confirms the WebAssembly SDK's prepend to
WasmNestedPublishAppDependsOn(_GatherWasmFilesToPublish) still composes on the CoreCLR side, as doesPrepareForWasmBuildAppfromeng/testing/tests.browser.targets.Not affected: in-tree builds of either flavor (already split by
RuntimeFlavor), WASI (no packaged CoreCLR split, and its CoreCLR targets define no nested-publish target), and the Helix/WBT CoreCLR leg (importsBrowserWasmApp.CoreCLR.targetsdirectly).Note
This change was drafted with GitHub Copilot.