Skip to content

[NativeAOT-LLVM] Compiling C# CLI tool to WASM: Cross-OS native compilation is not supported #1890

@devedse

Description

@devedse

A while back I've written a simple dotnet CLI tool which you can call like this:

DeveWeb3Cli.exe --argument blah

My goal is to compile this Dotnet tool to WASM so that eventually I could submit it to the NPM store.
(All for educational purposes 😄)

I tried following the following guide:
https://github.com/dotnet/runtimelab/blob/feature/NativeAOT-LLVM/docs/using-nativeaot/compiling.md

However when running the compile command:

dotnet publish -r browser-wasm -c Debug /p:TargetArchitecture=wasm /p:PlatformTarget=AnyCPU /p:MSBuildEnableWorkloadResolver=false --self-contained

I see the following error:

Microsoft (R) Build Engine version 17.2.0+41abc5629 for .NET
Copyright (C) Microsoft Corporation. All rights reserved.

  Determining projects to restore...
  All projects are up-to-date for restore.
  DeveWeb3Cli -> C:\XGitPrivate\DeveWeb3Cli\DeveWeb3Cli\bin\Debug\net6.0\browser-wasm\DeveWeb3Cli.dll
C:\Users\DavyDavidse\.nuget\packages\microsoft.dotnet.ilcompiler\7.0.0-alpha.1.22074.1\build\Microsoft.NETCore.Native.P
ublish.targets(60,5): error : Cross-OS native compilation is not supported. https://github.com/dotnet/corert/issues/545
8 [C:\XGitPrivate\DeveWeb3Cli\DeveWeb3Cli\DeveWeb3Cli.csproj]

I also tried running the command in a build on Linux but this had a different error:
https://github.com/devedse/DeveWeb3Cli/runs/6521022184?check_suite_focus=true

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions