[Mono-list] How to start a process? (Crossplatform)
Daniel Lo Nigro
lists at dan.cx
Sun Jun 9 12:18:34 UTC 2013
A bit hacky, but you could determine if the app is running under Mono by
checking for the presence of Mono-specific types:
var runningOnMono = Type.GetType("Mono.Runtime") != null;
This will also detect if they're using Mono on Windows, which isn't a
common use-case but might be something you want to handle?
To just determine if the user is running on a non-Windows platform, you can
use System.Environment.OSVersion.Platform and see whether it's equal
to PlatformID.Unix or PlatformID.MacOSX. On these platforms, you can assume
Mono is being used.
On Thu, Jun 6, 2013 at 8:08 PM, Sergey Khabibullin <x2bool at gmail.com> wrote:
> Hello, I am trying to start a process in my application.
> Process.Start("utility.exe", "my argument list");
> As you see the "utility.exe" is in the same directory as the application itself.
> Works fine for Windows and some Linux distros. But in other distros I can't start
> the utility just by "utility.exe", and I forced to use "mono utility.exe". I belive this behaveour
> is because of that in some distros mono binaries registered as executable files, and in others not.
> Obviously I can't force all users to use "Proper Linux Distro", and I can't always use "mono" prefix,
> or I lose the Windows platform. Is there any solution to this problem?
> Mono-list maillist - Mono-list at lists.ximian.com
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Mono-list