Search code examples
c#monomdtool

Mono Start Process mdtool Close the Caller


In a console app on Mono/OSX I want to call the mdtool to build an iOS project. I succeed to have the right command line arguments and it runs correctly in bash shell script.

Now If I call it with the Process/ProcessStartInfo classes in my console app, after the build I got this and my programm exits.

Press any key to continue... logout

[Process completed]

Here's the code to call mdtool:

var buildArgs = string.Format("...");

var buildiOSproject = new ProcessStartInfo
{
    FileName = "/Applications/MonoDevelop.app/Contents/MacOS/mdtool",
    UseShellExecute = false,
    Arguments = buildArgs
};
var exeProcess = Process.Start(buildiOSproject);
exeProcess.WaitForExit();
//code here never called

Solution

  • I got my answer on the Xamarin forums (http://forums.xamarin.com/discussion/267/calling-mdtool-trough-processstartinfo#latest) but it seems a problem with the debugger so I switch off the "Run on external console" property in the options of my project and it's working now.