C# Mono启动进程mdtool关闭调用者

C# Mono启动进程mdtool关闭调用者,c#,mono,mdtool,C#,Mono,Mdtool,在Mono/OSX上的控制台应用程序中,我想调用mdtool来构建一个iOS项目。我成功地获得了正确的命令行参数,并且它在bashshell脚本中正确运行 现在,如果我在我的控制台应用程序中使用Process/ProcessStartInfo类调用它,在构建之后,我得到了它,并且我的程序退出 Press any key to continue... logout [Process completed] 以下是调用mdtool的代码: var buildArgs = string.Format

在Mono/OSX上的控制台应用程序中,我想调用mdtool来构建一个iOS项目。我成功地获得了正确的命令行参数,并且它在bashshell脚本中正确运行

现在,如果我在我的控制台应用程序中使用Process/ProcessStartInfo类调用它,在构建之后,我得到了它,并且我的程序退出

Press any key to continue... logout

[Process completed]
以下是调用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

我在Xamarin论坛上得到了答案(http://forums.xamarin.com/discussion/267/calling-mdtool-trough-processstartinfo#latest)但调试器似乎有问题,因此我关闭了项目选项中的“在外部控制台上运行”属性,它现在可以工作了。

尝试将以下内容添加到StartInfo初始值设定项中。当另一个工具退出时,我遇到了同样的问题。虽然我已经使用了RedirectStandardOutput和RedirectStandardError,但只有在添加了RedirectStandardInput之后,我才能修复它

            buildiOSproject.StartInfo = new ProcessStartInfo
            {
...
                RedirectStandardOutput = true,
                RedirectStandardError = true,
                RedirectStandardInput = true,
...
            }