so I'm currently working on a BlueJ like clone for c#. Now I want to compile all the .cs files in the working folder on click for which I use: C:\Windows\Microsoft.NET\Framework\v4.0.30319\csc.exe /define:DEBUG /optimize /out:Program.exe *.cs which I took from the msdn page. For that to work though I need to be in the right directionary so I use the following: cd /d + dir where dir is the directionary of the files. Now when I try to run that from c# like this:
cmd = @"cd /d "+ dir + @" && C:\Windows\Microsoft.NET\Framework\v4.0.30319\csc.exe /define:DEBUG /optimize /out:Program.exe *.cs"; file = "cmd"; var proc = new Process(); proc.StartInfo = new ProcessStartInfo(file, cmd); proc.StartInfo.RedirectStandardOutput = true; proc.StartInfo.RedirectStandardError = true; proc.EnableRaisingEvents = true; proc.StartInfo.CreateNoWindow = true; proc.StartInfo.UseShellExecute = false; proc.ErrorDataReceived += proc_DataReceived; proc.OutputDataReceived += proc_DataReceived; proc.Start(); proc.BeginErrorReadLine(); proc.BeginOutputReadLine(); nothing happenes. But when I try to run the command in the cmd window it works fine. Any ideas?