MSDN states that it is possible in .NET to capture the output of a process and display it in the console window at the same time.
Normally when you set
See this answer here on SO which I posted code for a process to exec netstat an redirect the output stream to a Stringbuilder instance. The process creates a hidden window and is not visible...
You can modify the code slightly by changing the values respectively
ps.CreateNoWindow = true; <--- Comment this out... ps.WindowStyle = System.Diagnostics.ProcessWindowStyle.Hidden; <--- Comment this out...
you can easily catch all messages using
Process build = new Process();
...
build.StartInfo.UseShellExecute = false;
build.StartInfo.RedirectStandardOutput = true;
build.StartInfo.RedirectStandardError = true;
build.StartInfo.CreateNoWindow = true;
build.ErrorDataReceived += build_ErrorDataReceived;
build.OutputDataReceived += build_ErrorDataReceived;
build.EnableRaisingEvents = true;
...
and create the Event build_ErrorDataReceived
static void build_ErrorDataReceived(object sender, DataReceivedEventArgs e)
{
string msg = e.Data;
if (msg != null && msg.Length > 0)
{
// in msg you have the line you need!
}
}
I add a little example
Screencast of the application
Solution Files (VS 2008)