Configuration.Save () in .Net 3.5 does not work in deployment / release mode

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

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

Also, I also tried using SaveAs (persist \ MyApp_yyyymmdd.config). While running in debug mode inside Visual Studio 2008 (vhosting is disabled), it creates a "persist" folder in bin / Debug and saves the file there. However, the deployed version in C: \ UAT \ MyApp \ does not create such a folder. I made sure that 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 application is full trust" from Project Properties before deploying the application.

+2


source to share


1 answer


Values ​​for user preferences are usually stored in "user.config"

a user profile, especially for published applications. Exe.config is not really meant to be editable at runtime as it falls back to an issue with installation (secure system) and documents (user), especially for non-admins.

Check the location, for example:



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

+5


source







All Articles