Get rid of console window in console app
Sometimes you just need a simple program to do something for you. In my example, I have this app I am trying to install that requires .NET 4.0, but Windows 7 doesn’t come with .NET 4.0, so I have to check if it is there and if not, install it before I run my app. Usually, however, users need to reboot the PC after they install .NET 4.0, creating a condundrum of sorts for my end-users.
My app is an installer application that installs a bunch of apps to stage a PC. I definitely do not want to create a installer app that uses MSI, as that would just complicate the whole mess (we have been burned many times over with MSI - we are not loading simple apps, on the contrary).
So I need an installer for the installer. Simple enough.
I tried to use DemoShield as the front end, but that failed when it came to do some things that Windows 7 UAC wouldn’t let us (write to reg, for example).
So I decided to write a .NET 2.0 C# simple application, since .NET 2.0 comes with Windows 7, and most of our XP PCs out there have it. I am going to have this simple app check for .NET 4.0, install it, and force a reboot. But I am also going to put an entry in RunOnce in the registry to trigger my main installer application when the PC comes back up.
To make this simple app, I didn’t want a form or anything, so I created a console application, then I went into the Properties and changed it from a console app to a Windows application. Doing this will get rid of the console window when the app starts. It will not have any windows or consoles, it will just do its thing and end. Simple.