Giving .NET program an output type of windows application and console application
You can attach the console. Make the code in Program.cs look like this:
[STAThread]
static void Main(string[] args) {
if (args.Length > 0) {
AttachConsole(-1);
Console.WriteLine("");
Console.WriteLine("Running in console, press ENTER to continue");
Console.ReadLine();
}
else {
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new Form1());
}
}
[System.Runtime.InteropServices.DllImport("kernel32.dll")]
private static extern bool AttachConsole(int pid);