Windows Applications in Console Mode

I am writing an application that needs to run in both a Windows forms mode and in
a console application mode for scriptable operations. This is a reasonably common
requirement form utilitarian applications like zip utils, installers, and other types
of things. Indeed, one common way to get code under automated regression test is to
have the majority of the automation run against a command line version.

Now here is the weirdness… when I compile my C# application in VS2005 as a Windows
application, the Console.Out is set to null (I think) and all calls to Console.WriteLine()
are ineffective. I must compile as a console application to get the Console object
to function. What the… ?

I have only poked at this for a little while, but it is beyond me what is going on
here. What functionality am I not getting that my Windows app part needs now? Everything
seems to work fine.

Proudly powered by WordPress | Theme: Code Blog by Crimson Themes.