SDK 11.0.100 no longer sets SelfContained=true for browser-wasm projects, so net10.0 WASM apps that built on SDK 10 fail
I maintainer di solito rispondono entro 1 giorno
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Idoneità per principianti
- 48/100
- Tipo di issue
- Bug
- Chiarezza
- Specificata chiaramente
- Stato di attività
- Attiva
- Stack tecnologico
- csharp, wasm
- Ambito
- build-system
Direzione di ricerca
Compare the SDK 10 and SDK 11 Mono toolchain manifest targets named in the report, including the net10 manifest, and trace how SelfContained is set for browser-wasm projects. Start by reproducing the provided net10.0 project with SDK 11.0.100 and wasm-tools-net10; confirm the property and build behavior. Done means the runtime pack is resolved and the reproduction builds as it does with SelfContained=true.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Description
A net10.0 project with RuntimeIdentifier=browser-wasm (plain Microsoft.NET.Sdk) builds on SDK 10 but fails on SDK 11.0.100 with the wasm-tools-net10 workload installed.
On SDK 10, the Mono toolchain workload manifest sets SelfContained=true for every browser-wasm project
(sdk-manifests/10.0.100/microsoft.net.workload.mono.toolchain.current/<version>/WorkloadManifest.targets):
<PropertyGroup Condition="'$(RuntimeIdentifier)' == 'browser-wasm'">
<SelfContained>true</SelfContained>
On SDK 11.0.100, neither microsoft.net.workload.mono.toolchain.current nor microsoft.net.workload.mono.toolchain.net10 sets it. The SDK's own default (SelfContained=false for net8.0+ when only a RID is set) applies, so no runtime pack is resolved and the WASM build fails. A browser-wasm app cannot run without its runtime, so this looks unintended. I could not find it listed as a breaking change.
Reproduction Steps
Repro.csproj:
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net10.0</TargetFramework>
<RuntimeIdentifier>browser-wasm</RuntimeIdentifier>
<OutputType>Exe</OutputType>
</PropertyGroup>
</Project>
Program.cs:
System.Console.WriteLine("hello");
Then:
dotnet workload install wasm-tools-net10
dotnet build
dotnet msbuild -getProperty:SelfContained
Expected behavior
Builds, as on SDK 10.0.404 with wasm-tools; SelfContained evaluates to true.
Actual behavior
On SDK 11.0.100, SelfContained evaluates to false and the build fails:
Microsoft.NET.Runtime.WebAssembly.Sdk\10.0.15\Sdk\WasmApp.Common.targets(368,5): error : WasmAssembliesToBundle item is empty. No assemblies to process
In a larger project of the same kind (also WasmBuildNative=true, WasmAppDir set, a SQLite native package reference), the build instead fails earlier with:
Microsoft.NET.Runtime.WebAssembly.Sdk\10.0.15\Sdk\WasmApp.Common.targets(283,5): error : $(MicrosoftNetCoreAppRuntimePackDir)='', and cannot find %(ResolvedRuntimePack.PackageDirectory)=. One of these need to be set to a valid path
Setting SelfContained=true fixes both.
| SDK | Workload | SelfContained |
Build |
|---|---|---|---|
10.0.404 (Linux, mcr.microsoft.com/dotnet/sdk:10.0-noble) |
wasm-tools |
true |
succeeds |
| 11.0.100 (Windows) | wasm-tools-net10 |
false |
fails |
11.0.100 with -p:SelfContained=true |
wasm-tools-net10 |
true |
succeeds |
The same repro targeting net11.0 with wasm-tools on SDK 11.0.100 fails with the MicrosoftNetCoreAppRuntimePackDir error above.
Regression?
Yes. Works on SDK 10.0.404; fails on SDK 11.0.100.
Known Workarounds
Set <SelfContained>true</SelfContained> in the project.
Configuration
- SDK 11.0.100, Windows 11 x64; also reproduced on a Windows build agent with SDK 11.0.100
- Workload
wasm-tools-net10, manifest 11.0.100 (WebAssembly SDK pack 10.0.15) - Comparison: SDK 10.0.404 on Linux x64 (Docker), workload
wasm-tools10.0.115 manifests
Other information
Projects using the Blazor/WebAssembly SDKs may not be affected; not verified.
- Lingua principale
- C#
- Stelle
- 18.4k
- Fork
- 5.8k
- Merge medio
- 2g 19h
- PR unite (30g)
- 590
Preparare l'ambiente
Avvia il container di sviluppo del progetto nel browser, con il tuo account GitHub.
- Nessun Dockerfile né file Docker Compose
- Ha un modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di dotnet/runtime
-
area-Setup untriaged
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
dotnet/runtime#137376 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
area-System.Memory untriaged
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
dotnet/runtime#137334 · 4 commenti ·
I maintainer di solito rispondono entro 1 giorno
-
ImmutableSortedSet<T>.Builder: enumerating through IEnumerable<T> doesn't throw on modification and can return wrong itemsForse già presa @aw0lid l’ha presa 3 giorni fa. Apertaarea-System.Collections
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
dotnet/runtime#137167 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
DbTransaction.SupportsSavepoints docs say Release/ReleaseAsync are expected to throw, but they are no-ops by designForse già presa @alaricd l’ha presa 7 giorni fa. Apertaarea-System.Transactions untriaged
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
dotnet/runtime#137040 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
FileSystemGlobbing: Matcher throws ArgumentOutOfRangeException when the rootDir is the same value as the fileForse già presa @makazeu l’ha presa 7 giorni fa. Apertaarea-Extensions-FileSystem
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
dotnet/runtime#136989 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di dotnet/runtime
Issue simili
-
bug emitter:client:csharp
Difficoltà 2/5 1-3 ore Idoneità per principianti 84/100
microsoft/typespec#12572 · 1 commento · 1 reazione ·
I maintainer di solito rispondono entro 1 giorno
-
needs-area-label
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
I maintainer di solito rispondono entro 2 giorni
-
AWS Lambda: KeyNotFoundException drops HTTP-triggered transactions when allowAllHeaders is disabledApertabug
Difficoltà 2/5 1-3 ore Idoneità per principianti 70/100
newrelic/newrelic-dotnet-agent#3949 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
area-networking
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
dotnet/aspnetcore#70545 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 87/100
I maintainer di solito rispondono entro 1 giorno