I’m using configuration manager in the simplest way:
Read:
ConfigurationManager.AppSettings["Foo"]
Write:
Configuration config = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None);
config.AppSettings.Settings["Foo"].Value = value;
config.Save(ConfigurationSaveMode.Modified);
ConfigurationManager.RefreshSection("appSettings");
The problem is that after installing the application on different machines – some are looking for the file: “My.Application.exe.config”
while others look for “My.Application.config” (same, w/o the “.exe”)
Another interesting detail is that after installing VS on the problematic machines – it works ok.
And my question is: Ah?!!?
Any ideas?
Thanks for the responses, your links were very helpful.
Since this is a .NET issue (as described in the links above), I tackled it from a different angle than suggested:
Since my configuration file is vast and demands both read and write operations, i’m using a special class to handle it –
configurationFileHelper.What I did was adding a static constructor to this class, in which i’m inquiring the expected name for the file, and, if necessary, renaming the existing file to match it:
Hope this is helpful to someone…