Hi there
I just created a sample Project (.net CF for Windows Mobile 5.0 PocketPC) where I bind a XML to a DataGrid, and now I have the following problem:
I dont know how to define the file-path in the Code, it will come a FileNotFoundException
My definitions i tried:
xmlFileName ="\\..\\..\\AccountingData.xml";
xsdFileName ="\\..\\..\\AccountingData.xsd";
...="D:\\VisualStudio Projects\\Mobile\PocketAccaunting\\PocketAccaunting\\AccountingData.xml"
...="D:\\VisualStudio Projects\\Mobile\PocketAccaunting\\PocketAccaunting\\AccountingData.xsd"
xmlFileName ="\\AccountingData.xml";
xsdFileName ="\\AccountingData.xsd";
Position on the filesystem: D:\VisualStudio Projects\Mobile\PocketAccaunting\PocketAccaunting
But where does these files would be on the PocketPC

define xml-file & path
Bill Dafon
ok thx a lot, i'll imideatly check it out.
I'm using VS 2005.
PharmerNick
If you include the files you wish to deploy in your project then it will be deployed to the project output directory on your device.
To access a file make sure it exists first by using File.Exists(path to file).
As Ilya said, there are no drive letters or anything but to access a directory (which I have done and works) you could do:
string path = @"\someDir\someFile.ext";
if (File.Exists(path))
{
//do stuff
}
Paraclete
In solution explorer please select file of interest, right click and choose properties. Among other properties you would see "Build action" and "Copy to output directory", that's what you need to set.
I'm assuming you're using VS 2005; VS 2003 might be a bit different.
Queen
If these files are in the project, you can set action to "Content" and set deployment option to "Deploy always" or "Deploy if newer". VS would copy these files to the same folder on device as your EXE.
Now you would need to determine the folder EXE is in and construct full path to your XML files by combining EXE path with XML file names as described here:
http://wiki.opennetcf.org/ow.asp CompactFrameworkFAQ%2FStartupDirectory
@ character before string means this is verbatim string which won't be escaped.
"\\somedir\\somefile" and @"\somedir\somefile" would result in the same string.
ManniAT
The files I want to use I created in the project (the xml & xsd files) with the visual studio...
I know they exists. The output directory would be Program Files\Applicationname or
Could you please explain me what the "@" is for
thank you very much
Ksenia Mukhortova
When I Debug the App, the Files are going to deployed on the device I thought
But now I tried
xmlFileName = "\\Program Files\\PocketAccounting\\AccountingData.xml";
xsdFileName = "\\Program Files\\PocketAccounting\\AccountingData.xsd";
What is according to the device-file-path But it doesnt work too...
I checked the file explorer in the emulator and no xml file is there..
So how can I copy files to the emulator
thx a lot
bcristian
Sorry for my newbie-questions but im the totally VS and c# beginner.
Where can I set the action and deployment options
Busy
There are no drive letters and no relative paths on devices, so all your paths are invalid. Also, device can't see desktop drives, it has it's own independent file system. So, you could not access files on your desktop (unless they are shared and proper share path specified). You should copy these files on to device and specify appropriate path on device file system to make it work.