ResGen.exe stucks when redirect output

Posted by Darqer on Stack Overflow See other posts from Stack Overflow or by Darqer
Published on 2011-03-19T22:47:27Z Indexed on 2011/03/20 0:10 UTC
Read the original article Hit count: 243

Filed under:
|

Hello

I try to redirect standard output from ResGen.exe. I use following code

ProcessStartInfo psi = new ProcessStartInfo( "resxGen.exe" );
psi.CreateNoWindow = true;
psi.Arguments = sb.ToString();
psi.UseShellExecute = false;
psi.RedirectStandardOutput = true;
Process p = Process.Start( psi );
p.WaitForExit();
StreamReader sr = p.StandardOutput;
string message = p.StandardOutput.ReadToEnd();

It stuck on p.WaitForExit. When I turn off output stream redirection and do not read StandardOutput it works correctly.

What do I do wrong ?

© Stack Overflow or respective owner

Related posts about c#

Related posts about processes