Reputation: 2443
I have two console app projects (prj1 and prj2).
I have EF6 code first in prj2, build and then copied it's "Debug" folder into a separate directory (example : "D:\Debug").
In prj1, I am trying to run prj2 using :
Process p = new Process
{
StartInfo = new ProcessStartInfo("D:\\Debug\\prj2.exe")
};
p.Start();
Problem is, database is being created inside prj1's Debug folder (not in "D:\Debug"
But if I run the .exe of prj2 directly from "D:\Debug\prj2.exe" by double-click - everything works fine.
Upvotes: 0
Views: 51
Reputation: 347
You have to change your working (active) directory.
https://msdn.microsoft.com/en-us/library/system.io.directory.setcurrentdirectory(v=vs.110).aspx
Upvotes: 1
Reputation: 59
I think you should try with ProcessStartInfo.WorkingDirectory
var startInfo = new ProcessStartInfo("D:\\Debug\\prj2.exe");
startInfo.WorkingDirectory = "D:\\Debug";
Process p = new Process();
p.StartInfo = startInfo;
p.Start();
Upvotes: 1