2026-06-08 01:14:26 +05:00
2026-06-08 01:14:26 +05:00
2026-06-08 01:14:26 +05:00
2026-06-08 01:14:26 +05:00
2026-06-08 01:14:26 +05:00
2026-06-08 01:14:26 +05:00
2026-06-08 01:14:26 +05:00
2026-06-08 01:14:26 +05:00
2026-06-08 01:14:26 +05:00
2026-06-08 01:14:26 +05:00
2026-06-08 01:14:26 +05:00
2026-06-08 01:14:26 +05:00

mono-apphost

You created a C# program targeting dotnet6 or newer but users don't want to download and install 200 MB runtime from microsoft website? Here is the solution - portable and small (30 MB) runtime.

Original mono project was discontinued, but fortunately microsoft has their own fork of mono runtime in dotnet runtime repository. It is still used in mobile development and wasm, so they continue to update it.

Building

  1. Clone the repository with submodules

    git clone --recurse-submodules --depth 1 https://timerix.ddns.net/git/Timerix/mono-apphost.git
    
  2. Install cbuild v2.3

    ln -s SDL2_HEADERS_DIRECTORY_ABSOLUTE_PATH -T dependencies/include/SDL2
    
  3. Download and extract mono runtime nuget package

    • default version
      cbuild download_mono_from_nuget
      
    • or some specific version (list of versions)
      cbuild download_mono_from_nuget=x.y.z
      
    • or build your own .nupkg from dotnet source code
      git clone --depth 1 -b v10.0.8 https://github.com/dotnet/runtime dotnet-runtime
      cd dotnet-runtime
      ./build.sh mono+libs+packs.product --runtimeFlavor Mono --usemonoruntime --configuration Release --verbosity normal /p:DisableCrossgen=true
      
      • find Microsoft.NETCore.App.Runtime.*.nupkg in artifacts/packages/Release/Shipping/.
      • copy runtimes/*/native/include/mono-2.0/mono to ./dependencies/include/
      • copy shared library files from runtimes/*native/ to ./dependencies/precompiled/ except System.Private.CoreLib.dll, it must be in ./dependencies/precompiled/mono-libs
      • copy C# standard library from runtimes/*/lib/net10.0/ to ./dependencies/precompiled/mono-libs
  4. Compile the program

    cbuild build_exec_dbg
    
  5. Create program config

    • copy ./mono-apphost.toml to ./bin
    • change main_assembly_path
  6. Copy files from ./bin/ to your C# program build dir

Description
small portable C# runtime
Readme 46 KiB
Languages
Shell 59.8%
C 40.2%