question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

`wasm-tools` workload breaks `dotnet publish` in docker

See original GitHub issue

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)

Issue Analytics

  • State:open
  • Created 4 months ago
  • Comments:9 (8 by maintainers)

github_iconTop GitHub Comments

1reaction
baronfelcommented, Jun 20, 2023

@lewing it does exist on disk, but the thing that’s happening is the linux-x64 version of the pack is being downloaded, not the linux-musl-x64 version. As a result, the mono-aot-cross binary doesn’t launch and we get the ‘not found’ message (which is really a ‘couldn’t launch’ message).

image

Read more comments on GitHub >

github_iconTop Results From Across the Web

Can't Publish WASM to IIS
Since I'm using .NET 7, running dotnet workload install wasm-tools-net7 in Package Manager Console fixed the issue (restart Visual Studio ...
Read more >
Migrate from ASP.NET Core 6.0 to 7.0
The new wasm-tools-net6 workload includes the .NET WebAssembly build tools for .NET 6 projects so that they can be used with the .NET...
Read more >
Upgrade Your Existing Projects to .NET7 - ABP Community
NET 7 upgrade in our repositories for ABP Framework and ABP ... This release makes a breaking change in an EF Core query...
Read more >
Wasm workloads (Beta)
How to run Wasm workloads with Docker Desktop. ... Wasm workloads require the containerd image store feature to be turned on.
Read more >
Platform specific dependencies
NativeAssets.Linux.NoDependencies NuGet ensures that the libSkiaSharp.so file is published and available. ... dotnet workload install wasm-tools.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found