VBAHole22 Posted May 30, 2007 Posted May 30, 2007 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? Quote Wanna-Be C# Superstar
Administrators PlausiblyDamp Posted May 30, 2007 Administrators Posted May 30, 2007 The app.config file is really a VS nicety - the file itself should be .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. Quote Posting Guidelines FAQ Post Formatting Intellectuals solve problems; geniuses prevent them. -- Albert Einstein
VBAHole22 Posted May 30, 2007 Author Posted May 30, 2007 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. Quote Wanna-Be C# Superstar
Administrators PlausiblyDamp Posted May 30, 2007 Administrators Posted May 30, 2007 In that case you could simply have a app.config with an app setting that points to a network location and read your config from there. Quote Posting Guidelines FAQ Post Formatting Intellectuals solve problems; geniuses prevent them. -- Albert Einstein
VBAHole22 Posted May 30, 2007 Author Posted May 30, 2007 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. Quote Wanna-Be C# Superstar
Administrators PlausiblyDamp Posted May 31, 2007 Administrators Posted May 31, 2007 http://blog.gatosoft.com/PermaLink,guid,d0a0dd1e-c9ac-4fa9-a408-615454d49702.aspx might be worth a look, it uses MSBuild tasks to handle such a scenario (and as the article points out deploying to live straight from a development environment isn't a best practice anyway). Quote Posting Guidelines FAQ Post Formatting Intellectuals solve problems; geniuses prevent them. -- Albert Einstein
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.