Dynamically updating connectionstring (multiple connectionstrings) in app.config


  • Hi,

    I am dynamically updating connectionstring details based on user choice and its working fine but its updating file under bin/release (xml config file vshost.exe) but not the file under the project. 

    Anyone please suggest what should I do so that it would update app.config.

    Thanks a lot

    Wednesday, March 05, 2014 4:45 AM


  • If this is a WinForms application, then the file app.config never makes it out of the door!  It's copied by the build process (to your-program-name.exe.config) and that's what gets deployed with (and used by) your application when it runs for real.

    That said, after you've installed your application on your users machine, they almost certainly won't be able to update the your-program-name.exe.config file anyway!  One of the "Joys" of U.A.C. is that everything under C:\Program Files* is read-only to regular users so any attempt to write into this area will fail.

    I'd suggest you need to find somewhere else to persist these settings. 

    Regards, Phill W.

    Wednesday, March 05, 2014 12:15 PM