我正在使用 System.IO.File.Exists
检查文件是否存在。但是,对于我知道存在的文件,它返回 false。代码如下:
Assert.IsTrue(System.IO.File.Exists(@"\ImportRepositoryTest\Version2.xml"));
为什么 System.IO.File
在文件确实存在时返回 false?
最佳答案
尝试
Assert.IsTrue(System.IO.File.Exists(Path.Combine(TestContext.TestDeploymentDir, @"\ImportRepositoryTest\Version2.xml")));
关于c# - 为什么 System.IO.File 在文件确实存在时返回 false?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10770878/