-1

我写了一个简单的工具来加载一些配置:

stream = new StreamReader("configuration.xml");

作为独立它可以工作,但是当我像 procces 一样启动它时,它们会configuration.xml在父应用程序路径中查找文件。这是正常行为吗?

C:\My simple Tool\tool.exe 
C:\My simple Tool\configuration.xml

C:\ParentTool.exe 

ParentTool.exe正如我想的那样,由于应用程序的子进程tool.exe正在寻找configuration.xmlinC:\而不是 in "C:\My simple Tool\"

4

1 回答 1

0

您可以尝试更改:

stream = new StreamReader("configuration.xml");

至:

stream = new StreamReader(@"C:\My simple Tool\configuration.xml");
于 2013-08-07T17:25:05.963 回答