[英]Xamarin - System.IO.File - namespace 'File' does not exist
[英]How come System.IO.File is returning false when the file does exist?
我正在使用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")));
将其更改为Assert.IsTrue(System.IO.File.Exists(@".\\ImportRepositoryTest\\Version2.xml"));
(带有“。”),然后再次检查是否将文件标记为“始终复制”。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.