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

Samuel El-Borai samuel.elborai at gmail.com
Sun Oct 30 13:19:25 UTC 2016


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
<https://github.com/gluck/il-repack>

$ 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>...]

OPTIONS:

    --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]

Development:
    --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

Runtime:
    --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.

Cheers,

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


More information about the Mono-list mailing list