When setting a process, it seems like I'm not using that variable, WorkingDirectory
, in the proper manner. I get the error (with a catch)
ApplicationName='Test.exe', CommandLine='/d=1', CurrentDirectory='C:\Users\mb\Desktop\Integration\Tests\dailyTest\dailyTest\bin\Debug\Stress', Native error= The system cannot find the file specified.
However, in the folder Stress
, there is a Test.exe
... , so I really don't understand the meaning of this.
Why is there a failure and how can it be resolved?
The code is the following (note that I replaced variable with the direct string contents for better understanding).
Process proc = new System.Diagnostics.Process();
proc.StartInfo.WorkingDirectory = Directory.GetCurrentDirectory() + "\\" + "Stress");
proc.StartInfo.FileName = "Test.exe";
proc.StartInfo.Arguments = "/d=1";
proc.StartInfo.UseShellExecute = false;
proc.StartInfo.RedirectStandardOutput = false;
proc.Start ();
proc.WaitForExit();
return proc.ExitCode;
I know the WorkingDirectory is affected by UseShellExecute, however I respected this.
Directory.GetCurrentDirectory() + "\\" + "Stress"
, it's why Path.combine exists. – Oversubscribe