Problems using WindowsForm and CSharpCodeProvider
See the question and my original answer on StackOverflowYou should update your compiler options like this:
cp.CompilerOptions = "/target:winexe /optimize /win32icon:" + config.GetIconPath() + " MyForm.cs";
To instruct the compiler to compile a Windows/GUI app, and not a Console app (which is the default).