I have a .NET CF project. In the project directory I put a simple xml file (users.xml) which has to be read by the device. When I debug the application on device emulator and try to load the file from code, the Exception is thrown (FileNotFoundException "Could not find file '\\users.xml'."
).
Is there a mechanism to automatically deploy also configuration files to a device emulator?
You have you path set wrong in your code. After following the instruction of Shaihi or Sphynx to get Studio to deploy the file, the file is then in the folder with the application.
Based on the fact that you're getting an error that it cannot find "\users.xml" tells me that you're either telling it to specifically look in the root folder or you haven't specified a folder.
Windows CE requires that you provide a fully-qualified path, so your application should either use the full path it is deployed to (i.e. "\Program Files\MyApp\users.xml") or you need to construct the path:
Path.Combine(
Path.GetDirectoryName(
Assembly.GetExecutingAssembly().GetName().CodeBase
), "users.xml");
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With