通过运行exe成功生成输出文件。但是,当我尝试在同一次运行时打开输出文件时,我得到的是file Not Found Exception,但是当我再次运行该程序时,代码读取我的输出文件,并且我能够进行预处理。
private static void launchExe()
{
string filename = Path.Combine("//myPathToExe");
string cParams = "argumentsToExe";
var proc = System.Diagnostics.Process.Start(filename, cParams);
proc.Close();
}
private static void openOutputFile()
{
StreamReader streamReader = new StreamReader("//PathToOutputFile");
string content = streamReader.ReadToEnd();
/*
* Pre Processing Code
*/
}
在这个阶段,我得到文件找不到异常,但我有在指定的路径中生成的输出文件。
请帮我解决这个问题。