Code:
// Create an instance of the CSharpCodeProvider class.
Microsoft.CSharp.CSharpCodeProvider provider = new CSharpCodeProvider();
// Call the CodeDomProvider.CreateCompiler() method to obtain an ICodeCompiler from the provider.
System.CodeDom.Compiler.ICodeCompiler compiler = provider.CreateCompiler();
CompilerParameters cp = new CompilerParameters(referenceAssemblies,
exeFile, false);
// Generate an executable rather than a DLL file.
cp.GenerateExecutable = true;
cp.CompilerOptions += "/target=winexe";
// Invoke compilation.
CompilerResults cr = compiler.CompileAssemblyFromFile(cp, sourceFile);
I believe that is what is needed - /target=winexe is a parameter to the 'csc' C# compiler that says to make a Windows file.