Skip to content

wasm-tools workload breaks dotnet publish on Alpine Linux .NET SDK container image #32327

@tibuprophen

Description

@tibuprophen

Describe the bug

I am developing a Blazor WASM Application. I want to use the .NET 6 introduced Native Build for Sqlite (A nice package is delivered by this nice guy: https://github.com/JeremyLikness/SqliteWasmHelper).

To activate the Native Build Feature I need to install wasm-tools workload.

Developing on my Host machine works fine, but when I try to dockerize this, it comes to errors, especially setting the configuration as dotnet publish parameter in combination with installing the WASM-Tools:
✅ Not installing WASM Tools is working
✅ Installing WASM Tools without dotnet publish parameters is working
🚫 Installing WASM Tools and using dotnet publish parameters is not working

Please see my examples to reproduce for further details.

To Reproduce

✅ Not installing WASM Tools is working
FROM mcr.microsoft.com/dotnet/sdk:7.0-alpine

#RUN dotnet workload install wasm-tools
WORKDIR /app

RUN dotnet new blazorwasm -o BlazorEmpty
WORKDIR /app/BlazorEmpty
#RUN dotnet publish
RUN dotnet publish --configuration Release
✅ Installing WASM Tools without dotnet publish parameters is working
FROM mcr.microsoft.com/dotnet/sdk:7.0-alpine

RUN dotnet workload install wasm-tools
WORKDIR /app

RUN dotnet new blazorwasm -o BlazorEmpty
WORKDIR /app/BlazorEmpty
RUN dotnet publish
# RUN dotnet publish --configuration Release
🚫 Installing WASM Tools and using dotnet publish parameters is not working
FROM mcr.microsoft.com/dotnet/sdk:7.0-alpine

RUN dotnet workload install wasm-tools
WORKDIR /app

RUN dotnet new blazorwasm -o BlazorEmpty
WORKDIR /app/BlazorEmpty
# RUN dotnet publish
RUN dotnet publish --configuration Release

The last scenario should work imo. I get the following error:

 > [6/6] RUN dotnet publish --configuration Release:                                                                                                                                                                                                                
#0 0.551 MSBuild version 17.5.1+f6fdcf537 for .NET                                                                                                                                                                                                                  
#0 1.972   Determining projects to restore...                                                                                                                                                                                                                       
#0 3.204   All projects are up-to-date for restore.                                                                                                                                                                                                                 
#0 8.343   BlazorEmpty -> /app/BlazorEmpty/bin/Release/net7.0/BlazorEmpty.dll                                                                                                                                                                                       
#0 8.345   BlazorEmpty (Blazor output) -> /app/BlazorEmpty/bin/Release/net7.0/wwwroot
#0 8.526   Optimizing assemblies for size may change the behavior of the app. Be sure to test after publishing. See: https://aka.ms/dotnet-illink
#0 8.531   Optimizing assemblies for size. This process might take a while.
#0 12.77   Optimizing assemblies for size may change the behavior of the app. Be sure to test after publishing. See: https://aka.ms/dotnet-illink
#0 12.80   /bin/sh: /tmp/MSBuildTemproot/tmp2b43989dc6514e5c8ed88e234186b25d.exec.cmd: line 2: /usr/share/dotnet/packs/Microsoft.NETCore.App.Runtime.AOT.linux-x64.Cross.browser-wasm/7.0.5/Sdk/../tools/mono-aot-cross: not found
#0 12.80 /usr/share/dotnet/packs/Microsoft.NET.Runtime.WebAssembly.Sdk/7.0.5/Sdk/WasmApp.Native.targets(283,5): error MSB3073: The command ""/usr/share/dotnet/packs/Microsoft.NETCore.App.Runtime.AOT.linux-x64.Cross.browser-wasm/7.0.5/Sdk/../tools/mono-aot-cross" --print-icall-table > "/app/BlazorEmpty/obj/Release/net7.0/wasm/for-publish/runtime-icall-table.h"" exited with code 127. [/app/BlazorEmpty/BlazorEmpty.csproj]

It tells me mono-aot-cross: not found is not found and docker exited with code 127 (file in container not found), but the file is available.

Further technical details

  • Please let me know if you need any further technical details.
  • I've tested this on Docker for MacOS and Linux (Ubuntu)

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

Status

Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions