App.config for users

VBAHole22

Contributor
Joined
Oct 21, 2003
Messages
432
Location
VA
I want to have an xml config file that users can modify if they need to and my windows form application can access while running so that it too can read/write to the file.
So I added an app.config file and set to work. It works fine for what I need but when I do a ClickOnce deploy that xml file is not visible or accesible to the user anywhere.
How can I have the user and machine read/write config file and use ClickOnce together?
 
The app.config file is really a VS nicety - the file itself should be <name of executable>.exe.config and be within the same folder as the application itself at runtime.

By design the app.config isn't designed to be writeable by users as it needs to be in the same folder as the executable and this shouldn't be writeable by non-admins anyway.

User settings should be stored as part of the users profile - if you are writting the config file yourself then either isolated storage or Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) will put you in the correct place, under VS 2005 if you are using the built-in settings support this will also be taken care of for user settings.
 
Humm... The way i have it now I do get appname.exe.config and i can read/write to it from my app. The user can also navigate to the file and read/write to it. I'd like for my clients to be able to have a single version of this config file on the network for all users to read from so a change can be pushed to all of them. Looks like ClickOnce falls on it's face on this one based on some googling about it.
 
I suppose that would work. In that case though I would not even need the app.config file because I would be hard-coding the network location of the true config file. Based on what I have read if you deploy a ClickOnce app you cannot edit the app.config (even if you can find it) because it is hashed and checked.
 
Back
Top