views:

730

answers:

2

Hello... I am writing my first windows ce app. I am using an xml file (app.Config) to store state data... basically user preferences on the last location (connection string) that the person was using before closing the app. I am having trouble understanding what is happening on deploy. It looks like it is copying my xml file to the debug folder on deploy. My problem is, when I save the xml file it is not saving in my project. Is there another folder in which the emulator resides that contains all of the state data and possibly the file that I am writing out? I am saving the doc to the same filepath as I am reading in but it does not actually save or throw error or anything.

Any help is appreciated!

Thanks

A: 

You have to make sure you're reading and writing to the correct place. I was able to get something similar working using this post.

hemisphire
A: 

I can think of three possible issues that might cause this behaviour:

  1. The app.config gets renamed at compile/deploy time to MyFirstApp.exe.config. Make sure you are writing back to that filename and not app.config.
    app.config normally lives in your source folder and at compile time is copied to the bin\Debug directory. For .NETCF project the MyFirstApp.exe.config is then deployed to the emulator or the device.

  2. Make sure you are writing to the correct directory, this code snippet might help:

    string appDir = Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().GetName().CodeBase);

  3. You are doing everything correct but app.config replaces your changes in MyFirstApp.exe.config everytime your rebuild-all or deploy.

Philip Fourie