[mono-android] Console Application
Jonathan Pryor
jonp at xamarin.com
Fri Feb 3 16:02:25 UTC 2012
On Feb 3, 2012, at 7:48 AM, Ralph wrote:
> Is there a way to write and execute a linux console application with mono for android?
If your console app targets the Mono for Android profile assemblies, it should work within Mono for Android. This means that you can't target the "normal" .NET 2.0/4.0 profile assemblies, nor can you use gmcs/dmcs. You would instead need to use `smcs` (the Silverlight-profile compiler) against the Mono for Android mscorlib.dll/System.dll/etc. assemblies.
This may require source changes.
Other than that, it should work, you'd just need to add the .exe as a project reference to your Mono for Android application so that it would be included in the .apk, and then you could (untested!) use AppDomain.ExecuteAssemblyByName() to execute the assembly from the .apk.
> I want to include it in a service written with mono and execute it via Java.Lang.Runtime.Exec()
That's rather harder to do: java.lang.Runtime.exec() wants a native executable, and we don't provide a `mono` binary that you can execute, just a libmonodroid.so shared library. I don't see any way to allow this to work, unless you write a `mono` binary and distribute it with your app...
- Jon
More information about the Monodroid
mailing list