title: how to prevent to open in console my dynamically generated exe
body: <p>I am working in c# 4.0, i want to generate an executable file dynamically, so i used Code Dome, but when i executes it open in console and after then my form displays, i want to generate winform executable file. How can i achieve my aim. the code is below : </p>
  
  <pre><code>string Code = @"
  using System;
  using System.Windows.Forms;
  
  namespace CSBSS
  {
  static class Program
  {
  /// &lt;summary&gt;
  /// The main entry point for the application.
  /// &lt;/summary&gt;
  [STAThread]
  static void Main()
  {
  Application.EnableVisualStyles();
  Application.SetCompatibleTextRenderingDefault(false);
  Application.Run(new Form1());
  }
  }
  
  public class Form1 : Form
  {
  }
  }
  
  ";
  
  CodeDomProvider codeProvider = CodeDomProvider.CreateProvider("CSharp");
  
  string tempFolder = @"..\DynamicOutput";
  string Output = System.IO.Path.Combine(tempFolder, @"CSBSS.exe");
  if (!System.IO.Directory.Exists(tempFolder))
  {
      System.IO.Directory.CreateDirectory(tempFolder);
  }
  else
  {
      if (System.IO.File.Exists(Output)) System.IO.File.Delete(Output);
  }
  
  System.CodeDom.Compiler.CompilerParameters parameters = new CompilerParameters();
  parameters.ReferencedAssemblies.Add("System.dll");
  parameters.ReferencedAssemblies.Add("System.Windows.Forms.dll");
  
  parameters.TempFiles = new TempFileCollection(tempFolder, false);
  //Make sure we generate an exe.
  parameters.GenerateExecutable = true;
  parameters.GenerateInMemory = false;
  parameters.OutputAssembly = Output;
  
  
  CompilerResults results = codeProvider.CompileAssemblyFromSource(parameters, Code);
  
  string OutputMsg = "";
  if (results.Errors.Count &gt; 0)
  {
      string msgDescr = "";
      foreach (CompilerError CompErr in results.Errors)
      {
          msgDescr += "Line number " + CompErr.Line +
                      ", Error Number: " + CompErr.ErrorNumber +
                      ", '" + CompErr.ErrorText + ";" +
                      Environment.NewLine + Environment.NewLine;
      }
      OutputMsg = @"Error occured while generating executable file, please check following internal error 
  " + msgDescr;
      //return false;
  }
  else
  {
      OutputMsg = "Executable file has been generated successfully.";
  }
  </code></pre>