I have a test program in which I'm calling another program (let's call this the main program) with System.Diagnostics
. I'm having issues specifying which App.Config
the test program is using. It seems to always default to using the main program's app.config
. Is there a way to specify which file to use without changing the main program to use program arguments? See my code below.
Process process = new Process();
process.StartInfo.UseShellExecute = false;
process.StartInfo.FileName = @"...\MainProgram.exe";
process.StartInfo.CreateNoWindow = false;
process.StartInfo.WorkingDirectory = @"...\TestProgram\bin\Debug";
process.Start();
I assume you can copy the file you want to use to ensure that it is the one you need.
Use
File.Copy
to accomplish that.