我试图将文件复制到映射的网络位置。 如果我尝试手动执行,一切正常。将文件复制到另一台计算机上的共享文件夹
通过运行下面的代码我没有得到任何异常,但在需要的位置,我没有得到的代码。
string _sharedLocation = @"C:\Users\pddd\AppData\Roaming\Microsoft\Windows\Network Shortcuts\system-tests";
if (Directory.Exists(_sharedLocation) && File.Exists(@"c:\\Automation\\Tests\\Test1\\events.json"))
{
File.Copy(@"c:\\Automation\\Tests\\Test1\\events.json", Path.Combine(_sharedLocation, "events11.json"), true);
}
与问题的任何建议。
你确定你不只是捕获异常其他地方?目标文件夹是否需要验证? – Codor
看看[复制网络共享驱动器上的文件](http://stackoverflow.com/questions/1432213/copy-file-on-a-network-shared-drive)可能会给你一个线索 –
看看在 http://stackoverflow.com/questions/15801748/copying-local-file-to-network-shared-drive-issues 或 http://stackoverflow.com/questions/1432213/copy-file -on-a-network-shared-drive –