views:

455

answers:

1

Hi,

As suggested on msdn social forum, http://social.msdn.microsoft.com/Forums/en-US/netfxbcl/thread/ab59671a-f0a3-4182-ba5b-7fa17f0a6118?prof=required

I turned off the the Visual Studio hosting process and verified that the changes are saved to MyApp.exe.config file instead of MyApp.vhost.exe.config file when still running under Debug configuration. However when I deployed my application with Release configuration to C:\UAT\MyApp\, it would not save the changes to C:\UAT\MyApp\Application Files\MyAPP_1_0_0_0\MyApp.exe.config file. I checked file permissions and made sure that ReadOnly is not checked for MyApp.exe.config file.

In addition, I also tried to SaveAs(persist\MyApp_yyyymmdd.config). While running in Debug mode inside Visual Studio 2008 (vhosting turned off), it does create 'persist' folder under bin/Debug and saves the file there. However the deployed version in C:\UAT\MyApp\ does not create such folder. I made sure all folders under C:\UAT are not set to ReadOnly.

I am using Visual Studio 2008. Appreciate any help on this.

Follow up: I also made sure that Security was set to 'This is a full trust application' from Project Properties before deploying the application.

+4  A: 

Values for user settings are typically saved to a "user.config" in the user's profile, especially for published apps. The exe.config is not really intended to be edited at runtime, as it comes back to the installation (protected by system) vs documents (user) issue, especially for non-admins.

Check for a location such as:

{user profile}\AppData\Local{appname}\{appname}.exe_{gibberish}\user.config

Marc Gravell
Hi Marc,Thanks for pointing in the right direction. I found that after the config is loaded initially, any successive saves go to {user profile}\Application Data\Local Settings\Apps\....When application restarts, it picks up the last saved config from the "user.config".
Amit
Thanks. I've misguidedly been trying to edit the .exe.config of the running application.
frou