Name: Vengeance 2009-07-20 22:44
using System;
using System.Windows.Forms;
using System.Text;
using System.Reflection;
using Microsoft.CSharp;
using System.CodeDom.Compiler;
namespace Builder
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
StringBuilder strb = new StringBuilder();
strb.Append("using System;");
strb.Append("using System.Windows.Forms;");
strb.Append("public class main");
strb.Append("{");
strb.Append("public static void Main()");
strb.Append("{");
strb.Append("MessageBox.Show(\"");
strb.Append(textBox1.Text);
strb.Append("\");");
strb.Append("}");
strb.Append("}");
string source = strb.ToString();
ICodeCompiler compiler = new CSharpCodeProvider().CreateCompiler();
CompilerParameters args = new CompilerParameters();
args.CompilerOptions = "/target:winexe";
args.OutputAssembly = "gay.exe"; //Name
args.GenerateExecutable = true;
foreach (Assembly asm in AppDomain.CurrentDomain.GetAssemblies())
{
args.ReferencedAssemblies.Add(asm.Location);
}
CompilerResults build = compiler.CompileAssemblyFromSource(args, source);
foreach (CompilerError ce in build.Errors)
{
MessageBox.Show(ce.ErrorNumber + " " + ce.ErrorText);
}
}
private void Form1_Load(object sender, EventArgs e)
{
}
}
}This is a very ghetto way of doing it, this was my attempt. D: