30724de4d84ee36c204e276f000495bc97da41d8
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
-
Clone the repository with submodules
git clone --recurse-submodules --depth 1 https://timerix.ddns.net/git/Timerix/mono-apphost.git -
Install cbuild v2.3
ln -s SDL2_HEADERS_DIRECTORY_ABSOLUTE_PATH -T dependencies/include/SDL2 -
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.*.nupkginartifacts/packages/Release/Shipping/. - copy
runtimes/*/native/include/mono-2.0/monoto./dependencies/include/ - copy shared library files from
runtimes/*native/to./dependencies/precompiled/exceptSystem.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
- find
- default version
-
Compile the program
cbuild build_exec_dbg -
Create program config
- copy
./mono-apphost.tomlto./bin - change
main_assembly_path
- copy
-
Copy files from
./bin/to your C# program build dir
Description
Languages
Shell
59.8%
C
40.2%