Reputation: 7213
I have a C# project on OSX that I built and execute through Xamarin. How can I run this project from the command line? What parameters do I need to pass to mono
?
Upvotes: 2
Views: 2113
Reputation: 7213
While my Xamarin project was originally building an OSX app instead of a standalone mono executable, it is possible first to build a seperate executable and run that with mono.
For me this involved running mcs
(the mono compiler) with every source file and every DLL used by my Xamarin project. Most of my source files were in a single directory, and Xamarin kindly gathers all your DLLs in a directory for you under ./bin/Debug/XXXXXXXXXXX.app/Contents/MonoBundle/
. I took all these DLLs, moved them to a new directory lib
. Then I could compile my project like this:
mcs *.cs -r:lib/MonoMac.dll -r:lib/MoreLinq.dll -r:lib/OpenTK.dll
This will output a mono executable with the name of the first source file. It can be run by copying the file into the lib
directory and running it there:
cp Program.exe lib
cd lib
mono Program.exe
Upvotes: 0
Reputation: 74144
The normal way to run an application you have compiled with Mono would be to invoke it through the Mono runtime, like this:
mono myprogram.exe
Ref: The highly outdated doc page @ http://www.mono-project.com/archived/guiderunning_mono_applications/
So, in the most basic form, you only need to pass your CIL-based .exe
to the mono
runtime/executable. For advanced needs, consult the man
page for mono for additional options:
man mono
NAME
mono - Mono's ECMA-CLI native code generator (Just-in-Time and Ahead-of-
Time)
SYNOPSIS
mono [options] file [arguments...]
mono-sgen [options] file [arguments...]
~~~~~~
Upvotes: 1