You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[release/6.0] [wasm] Require workloads if using @(NativeFileReference) (#58290)
* [wasm] Require workloads, if a project is using native references
Currently, if the `wasm-tools` workload is not installed, and a project
uses AOT, then the build fails with an error saying that the workload
is needed.
But if the project is using native references, but not AOT, then the
build does not fail. Instead, the `@(NativeFileReference)` just gets
ignored. Even though the wasm workload is needed to relink dotnet.wasm
with the native libraries.
Implementation:
- `$(RunAOTCompilation)` is a property, so it can be checked, and
wasm workload imports can be enabled.
- But `@(NativeFileReference)` is an item, and that gets evaluated in
the second phase, so we can't use that to affect the imports.
- Instead, we emit a warning from a target run before Build, if the
project has any native references, but the workload isn't enabled.
- Users can explicitly enable the workload by setting
`$(WasmBuildNative)==true`.
* Bump sdk for workload testing to 6.0.100-rc.2.21425.12
* Fix path to workload.stamp file
Co-authored-by: Ankit Jain <[email protected]>
<WorkloadDisabledWithReason Condition="'$(_NativeBuildNeeded)' == 'true'">WebAssembly workloads (required for AOT) are only supported for projects targeting net6.0+</WorkloadDisabledWithReason>
13
-
</PropertyGroup>
14
-
15
10
<PropertyGroup Condition="'$(RuntimeIdentifier)' == 'browser-wasm' AND '$(UsingBrowserRuntimeWorkload)' == ''">
16
-
<UsingBrowserRuntimeWorkload Condition="'$(RunAOTCompilation)' == 'true' or '$(UsingMicrosoftNETSdkBlazorWebAssembly)' != 'true'" >true</UsingBrowserRuntimeWorkload>
11
+
<!-- $(WasmBuildNative)==true is needed to enable workloads, when using native references, without AOT -->
12
+
<UsingBrowserRuntimeWorkload Condition="'$(RunAOTCompilation)' == 'true' or '$(WasmBuildNative)' == 'true' or '$(UsingMicrosoftNETSdkBlazorWebAssembly)' != 'true'" >true</UsingBrowserRuntimeWorkload>
Text="%40(NativeFileReference) is not empty, but the native references won't be linked in, because neither %24(WasmBuildNative), nor %24(RunAOTCompilation) are 'true'. NativeFileReference=@(NativeFileReference)" />
Text="WebAssembly workloads, required for linking native files (from %40(NativeFileReference)), are only supported for projects targeting net6.0+ ." />
0 commit comments