No process window for C# console apps

When I’m using windows and I need a quick and dirty app which is never going to be cross-platform, I like to use C# .Net. It’s pretty fast to get something up and running, and C# is enjoyable to work with. One of the things I often find myself trying to do is prevent an ugly console window from opening up when I’m running an app. There are multiple ways to do this, but they all have their drawbacks.

First method:
Process proc= new Process();
proc.StartInfo.FileName = "cmd.exe"; 
proc.StartInfo.CreateNoWindow = true;
proc.Start();

Drawback: CreateNoWindow doesn’t work if you start a process with UseShellExecute = true.

Second method:
Process proc= new Process();
proc.StartInfo.FileName = "cmd.exe"; 
proc.WindowStyle = ProcessWindowStyle.Hidden;
proc.Start();

Drawback: ProcessWindowStyle.Hidden is only a suggestion, and the child process can always show itself.

Third method:
[DllImport("user32.dll")]
static extern IntPtr FindWindow(string lpClassName,string lpWindowName);
 
[DllImport("user32.dll")]
static extern bool ShowWindow(IntPtr hWnd, int nCmdShow);
 
const int SW_HIDE = 0;
const int SW_SHOW = 5;
 
static void Main()
{
    Process proc = new Process();
    proc.StartInfo.Verb = "Print"; 
    proc.Start(); 
    ShowWindow(hWnd, SW_HIDE); // Hide console window
}

Drawback: Dll imports are ugly. Why can’t I do this in regular .Net?

And a little trick:
If you don’t need your console app to show up at all, go to your project configuration and change your output type to “Windows Application”.