3

Visual Studio waits for the prebuild/postbuild script to complete to show the output. Is there an option to force it to flush on new line for example?

2
  • This is an entirely normal and inevitable side-effect of output redirection. Programs switch to buffered mode when they are redirected, no output is written until the buffer fills up (usually ~2KB) or the program stops running. David Cutler described this Unix feature sardonically by singing "getta byte, getta byte, getta byte byte byte" to the tune of the William Tell overture. Nothing you can do about it but sing while you wait. Aug 3, 2016 at 12:24
  • Normally you have streamed output for standart/error output and you can read the data line by line. I guess it's not implemented that way in VS.
    – f0rt
    Aug 5, 2016 at 18:19

1 Answer 1

3

I tested the behaviour with VS2010 and a small C# script started in a postbuildStep. My script writes several lines to the console, waiting 200ms after each line.

Yes. The output comes flushed in the output window, when the subprocess finishes.

Adding a manual Flush() after each WriteLine in the script does not help.

So this is a behaviour, I've seen, when starting a subprocess and consuming the console output via a simple ReadToEnd(). A correct implementation should use ReadLineAsync()

Seems to be standard behaviour in Visual Studio. I guess this is the way it was implemented in VS.

1
  • This are my observations too. I hoped for a setting to override this behavior.
    – f0rt
    Aug 5, 2016 at 18:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.