我正在使用System.IO.File.Exists检查文件是否存在。但是,对于我知道存在的文件,它返回false。代码如下:
Assert.IsTrue(System.IO.File.Exists(@"\ImportRepositoryTest\Version2.xml"));当文件存在时,为什么System.IO.File返回false?
发布于 2012-05-28 22:57:15
试一试
Assert.IsTrue(System.IO.File.Exists(Path.Combine(TestContext.TestDeploymentDir, @"\ImportRepositoryTest\Version2.xml")));发布于 2012-05-27 08:59:44
将其更改为Assert.IsTrue(System.IO.File.Exists(@".\ImportRepositoryTest\Version2.xml")); (带".")并仔细检查您的文件是否标记为“始终复制”。
https://stackoverflow.com/questions/10770878
复制相似问题