Kod:
System.Windows.Forms.SaveFileDialog sf = new System.Windows.Forms.SaveFileDialog();
sf.Filter = "(*.exe) | *.exe";
sf.Title = app_name;
if (sf.ShowDialog() == DialogResult.OK)
{
string filepath = sf.FileName;
//generate
txtStatus.Clear();
CSharpCodeProvider csc = new CSharpCodeProvider(new Dictionary<string, string>() { { "CompilerVersion", txtFramework.Text } });
CompilerParameters parameters = new CompilerParameters(new[] { "mscorlib.dll", "System.Core.dll", "System.dll", "System.Data.dll", "System.Windows.dll", "System.Windows.Forms.dll" }, txtOutput.Text, true)
{
GenerateExecutable = true
};
//error
CompilerResults results = csc.CompileAssemblyFromSource(parameters, richTextBox1.Text);
if (results.Errors.HasErrors)
results.Errors.Cast<CompilerError>().ToList().ForEach(error => txtStatus.Text += error.ErrorText + "\r\n");
else
{
txtStatus.Text = "--Build Succed";
}
//generate
}
else
{
MessageBox.Show("Ok, go away.", app_name, MessageBoxButtons.OK, MessageBoxIcon.Error);
}
göremezseniz [hastebin]
Böyle bir kod buldum, savefiledialog ekledim ancak filepath stringini nereye koyacağımı bulamadım. (bu bir compile kodu)