Skip to content

Commit

Permalink
[wasm] Build WasmAppHost with UseAppHost=false (#70606)
Browse files Browse the repository at this point in the history
* [wasm] Build WasmAppHost with UseAppHost=false

- WasmAppHost is included in the WebAssembly.Sdk pack, and doesn't have a
platform specific package.
- Since, this is being built for x64, the build defaults to using the
app host, which means that we get a single binary file that can be run
directly.
    - But this also means that the binary included in the
    WebAssembly.Sdk platform-agnostic package will target the platform
    where it was built.

- Instead, build with UseAppHost=false, and update the wasm host to use
the managed assembly instead.

And update the RunCommand to use `dotnet exec WasmAppHost.dll`.

* fix
  • Loading branch information
radical committed Jun 13, 2022
1 parent 6418252 commit 4277bc5
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/mono/wasm/build/WasmApp.targets
Original file line number Diff line number Diff line change
Expand Up @@ -120,8 +120,9 @@
</PropertyGroup>

<PropertyGroup Condition="'$(WasmGenerateAppBundle)' == 'true'">
<RunCommand>$([MSBuild]::NormalizePath($(WasmAppHostDir), 'WasmAppHost'))</RunCommand>
<RunArguments Condition="'$(RunArguments)' == ''">--runtime-config $(_AppBundleDirForRunCommand)/$(AssemblyName).runtimeconfig.json $(WasmHostArguments)</RunArguments>
<RunCommand Condition="'$(DOTNET_HOST_PATH)' != '' and Exists($(DOTNET_HOST_PATH))">$(DOTNET_HOST_PATH)</RunCommand>
<RunCommand Condition="'$(RunCommand)' == ''">dotnet</RunCommand>
<RunArguments Condition="'$(RunArguments)' == ''">exec $([MSBuild]::NormalizePath($(WasmAppHostDir), 'WasmAppHost.dll')) --runtime-config $(_AppBundleDirForRunCommand)/$(AssemblyName).runtimeconfig.json $(WasmHostArguments)</RunArguments>
<RunWorkingDirectory Condition="'$(RunWorkingDirectory)' == ''">$(_AppBundleDirForRunCommand)</RunWorkingDirectory>
</PropertyGroup>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
<TargetFramework>$(AspNetCoreAppCurrent)</TargetFramework>
<CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies>
<NoWarn>$(NoWarn),CA2007</NoWarn>
<UseAppHost>false</UseAppHost>
</PropertyGroup>

<ItemGroup>
Expand Down
1 change: 1 addition & 0 deletions src/mono/wasm/host/WasmAppHost.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
<CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies>
<NoWarn>$(NoWarn),CA2007</NoWarn>
<Nullable>enable</Nullable>
<UseAppHost>false</UseAppHost>
</PropertyGroup>

<ItemGroup>
Expand Down

0 comments on commit 4277bc5

Please sign in to comment.