[Mono-list] Pass arguments to executable generated by mkbundle

Samuel El-Borai samuel.elborai at gmail.com
Fri Nov 4 16:13:23 UTC 2016

Oh, great. Thank you Miguel.
I’ll take some time this weekend to try your patch.

Samuel El-Borai

On 3 November 2016 at 04:26:15, Miguel de Icaza (miguel at microsoft.com)


I have submitted a fix to master and the mono-4.8.0-branch, in the
meantime, you can get it by applying this patch locally:



*From: *Mono-list <mono-list-bounces at lists.dot.net> on behalf of Samuel
El-Borai <samuel.elborai at gmail.com>
*Date: *Sunday, October 30, 2016 at 9:19 AM
*To: *"mono-list at lists.dot.net" <mono-list at lists.dot.net>
*Subject: *[Mono-list] Pass arguments to executable generated by mkbundle

Hi the mailing list,

I’m trying to use mkbundle to generate a single file executable for my
project. It works great so far but I cannot find a way to pass arguments to
my program.

I’m using it like this:

1 - Compile my project via Xamarin studio

2 - Merge assemblies into a single assembly with ILRepack

$ mono ~/.config/NuGet/packages/ILRepack.2.0.12/tools/ILRepack.exe
/internalize /parallel /targetplatform:v4 /verbose /out:myapp
MyApp.exe *.dll

3 - Create a bundle containing my assembly and the mono runtime

$ mkbundle --simple --cross 4.6.1-linux-libc2.12-amd64 -o myapp_out ./myapp

At this point I can run ./myapp_out and it works. But when I try to pass
arguments I have an error:

# I run the app without arguments, it works as expected

$ ./myapp_out

c-Found: config:myapp 8f1000

ERROR: missing parameter '--keys'.

USAGE: myapp [--help] --keys [<KEYS>...]


    --keys [<KEYS>…]    Keys to process

    --help                display this list of options.

# I try to run it with an argument, it fails

$ ./myapp_out --keys test_key

c-Found: config:myapp 8f1000

Unknown command line option: '--keys'

# If I run it with `--help` I get the help from `mono`

$ ./myapp_out --help

Usage is: mono [options] program [program-options]


    --aot[=<options>]      Compiles the assembly to native code

    --debug[=<options>]    Enable debugging support, use --help-debug
for details

    --debugger-agent=options Enable the debugger agent

    --profile[=profiler]   Runs in profiling mode with the specified
profiler module

    --trace[=EXPR]         Enable tracing, use --help-trace for details

    --jitmap               Output a jit method map to /tmp/perf-PID.map

    --help-devel           Shows more options available to developers


    --config FILE          Loads FILE as the Mono config

    --verbose, -v          Increases the verbosity level

    --help, -h             Show usage information

    --version, -V          Show version information

    --runtime=VERSION      Use the VERSION runtime, instead of autodetecting

    --optimize=OPT         Turns on or off a specific optimization

                           Use --list-opt to get a list of optimizations

    --security[=mode]      Turns on the unsupported security manager
(off by default)

                           mode is one of cas, core-clr, verifiable or validil

    --attach=OPTIONS       Pass OPTIONS to the attach agent in the runtime.

                           Currently the only supported option is 'disable'.

    --llvm, --nollvm       Controls whenever the runtime uses LLVM to
compile code.

    --gc=[sgen,boehm]      Select SGen or Boehm GC (runs mono or mono-sgen)

    --arch=[32,64]         Select architecture (runs mono32 or mono64)

Any guidance would be appreciated.


Samuel El-Borai
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.dot.net/pipermail/mono-list/attachments/20161104/efa301d8/attachment.html>

More information about the Mono-list mailing list