Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/.net/23.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 存在的文件的FileNotFound异常_C#_.net - Fatal编程技术网

C# 存在的文件的FileNotFound异常

C# 存在的文件的FileNotFound异常,c#,.net,C#,.net,我正在尝试将文件从特定结构复制到更具归档性的格式 foreach (string line in lines) { if (line.Contains("INSERT INTO BACKLOGITEM_ATTACHMENT VALUES")) { string AttachementID = line.Split(',', ')')[1];

我正在尝试将文件从特定结构复制到更具归档性的格式

        foreach (string line in lines)
        {
            if (line.Contains("INSERT INTO BACKLOGITEM_ATTACHMENT VALUES"))
            {
                string AttachementID = line.Split(',', ')')[1];
                string FileName = AttachementsDictionary[AttachementID];
                string BacklogAttachementScrumID = BacklogLookupDictionary[AttachementID];
                BacklogItem Story = BacklogItemDictionary[BacklogAttachementScrumID];
                Product Product = ProductDictionary[Story.ProductScrumId];

                string FileToCopy = "C:\\attachments\\product" + Story.ProductScrumId + "\\attachement" + AttachementID;
                string FileToSave = "C:\\ScrumWorksAttachementExport\\" + Product.ProductName + "\\" + Product.StoryPrefix + "-" + Story.StoryTitle + "\\" + FileName;

                File.Copy(FileToCopy, FileToSave);

            }
        }
我收到一个文件未找到异常:

但文件位置是正确的:


为什么File.Copy()无法移动看似存在的文件?

异常中的文件名中有一个额外的“e”:“attachement10341”。文件系统没有:“attachment10341”。

异常中的文件名中有一个额外的“e”:attachement10341。文件系统没有:“attachment10341”。

lol。你在阅读答案时一定笑了。我的傻瓜帽在哪里?@DavidTunnell我自己的傻瓜帽太旧了,它也有自己的漏洞。:)哈哈。你一定是在读答案的时候笑了。我的傻瓜帽呢?@DavidTunnell我自己的傻瓜帽太旧了,它也有自己的虫子。:)