I am making a c# compiler and my code creates an executable that is automatically created in the startup folder(Working Directory). Is there any way to change the path in which the EXE is created before creating it.
This code creates an executable in "C:\Users\User\Desktop\CSharp Compiler\CSharp Compiler\bin\Debug"
CSharpCodeProvider csc = new CSharpCodeProvider(new Dictionary<string, string>() { { "CompilerVersion", "v4.0" } });
CompilerParameters parameters = new CompilerParameters(new[] { "mscorlib.dll", "System.Core.dll" }, ProjectName.Text + ".exe", true);
parameters.GenerateExecutable = true;
System.CodeDom.Compiler.TempFileCollection tfc = new TempFileCollection(Application.StartupPath, false);
CompilerResults cr = csc.CompileAssemblyFromSource(parameters, txtcode.Text);
if (cr.Errors.HasErrors)
{
//Do something if there is an error here...
}
else
{
//Start the application if there is no errors
Process.Start(Application.StartupPath + "/" + ProjectName.Text + ".exe");
}