2

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.

1 Answer 1

4

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

2
  • 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
    Oct 5, 2009 at 11:29
  • Thanks. I've misguidedly been trying to edit the .exe.config of the running application.
    – xyz
    Dec 4, 2009 at 14:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.