Copying file to windows ce device using c#

2.5k Views Asked by At

I have a portable windows ce device. I am writing an application to copy files from windows 7 to windows ce using RAPI. This is the code i use.

Mobile.Device.CopyFileToDevice(@"C:\Users\username\AppData\Local\Temp\AssetList.xml”, @“\Flash Disk\AMM\AssetList.xml”);

Both paths and files exist. When it reaches that line of code it throws an error

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

When i look on the device a AssetList.xml gets created with 0 kb . Please help.

2

There are 2 best solutions below

0
On

One of your problems is that you are missing a quote ". Your code should not even compile, so change

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

to

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

Try This:

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