Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/338.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

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# 使用c将文件复制到windows ce设备#_C#_Windows Ce_Rapi - Fatal编程技术网

C# 使用c将文件复制到windows ce设备#

C# 使用c将文件复制到windows ce设备#,c#,windows-ce,rapi,C#,Windows Ce,Rapi,我有一个便携式windows ce设备。我正在编写一个应用程序,使用RAPI将文件从windows 7复制到windows ce。 这是我使用的代码 Mobile.Device.CopyFileToDevice(@"C:\Users\username\AppData\Local\Temp\AssetList.xml”, @“\Flash Disk\AMM\AssetList.xml”); 路径和文件都存在。当它到达那行代码时抛出一个错误 "object reference not set t

我有一个便携式windows ce设备。我正在编写一个应用程序,使用RAPI将文件从windows 7复制到windows ce。 这是我使用的代码

Mobile.Device.CopyFileToDevice(@"C:\Users\username\AppData\Local\Temp\AssetList.xml”, @“\Flash Disk\AMM\AssetList.xml”);
路径和文件都存在。当它到达那行代码时抛出一个错误

 "object reference not set to an instance of an object".

当我查看设备时,会创建一个0 kb的AssetList.xml。请提供帮助。

您的问题之一是缺少一个引号。您的代码甚至不应该编译,所以请更改

Mobile.Device.CopyFileToDevice(C:\Users\username\AppData\Local\Temp\AssetList.xml"

试试这个:

    RAPI rapi = new RAPI();
    rapi.Connect(true, 10);
    rapi.CopyFileToDevice(localFile, remoteFile, true);

这是您的真实代码吗?您错过了路径开头的
。对不起,代码有变量。我将进行编辑。@LuckyLuke2:您是否已使用Active Sync将PDA正确连接到PC,请检查连接是否正确。
    RAPI rapi = new RAPI();
    rapi.Connect(true, 10);
    rapi.CopyFileToDevice(localFile, remoteFile, true);