How to spawn a process and capture its STDOUT in .NET? [duplicate]
Here’s code that I’ve verified to work. I use it for spawning MSBuild and listening to its output: process.StartInfo.UseShellExecute = false; process.StartInfo.RedirectStandardOutput = true; process.OutputDataReceived += (sender, args) => Console.WriteLine(“received output: {0}”, args.Data); process.Start(); process.BeginOutputReadLine();