I want to create a console window and print some info on it when debugging my program. VS 2010 does not give me the option of setting different Output types for my program depending on whether its in debug or release mode, so I resorted to creating a Console window manually like so:
[DllImport("kernel32.dll")]
public static extern Int32 AllocConsole();
static void Main()
{
#if DEBUG
AllocConsole();
#endif
....
That pops open a console window, but nothing gets written to it. I tried a bunch of other pinvoke (AttachConsole etc...) that did nothing. Then I finally tried running the application outside of Visual Studio, and the Console Window worked. Apparently Visual Studio is eating up all my Console.WriteLines!
How can I fix this?