Hi,
I am trying to modify the userSettings section (Properties.MyApp.Default) in the MyApp.exe.config file during the installatio of my WPF application using an MSI installer.
I basically implemented it like in this excellent article: http://raquila.com/software/configure-app-config-application-settings-during-msi-install/
The difference is that I am not editing the appSettings but the userSettings section.
The problem is that although the code runs fine, the settings are not saved. After the installation the config file contains the old settings I use in my development environment. I also tried to override OnAfterInstall(System.Collections.IDictionary stateSaver) instead of Install(System.Collections.IDictionary stateSaver) but it doesn't make a difference.
Here is the code that should change the config values:
protected override void OnAfterInstall(IDictionary savedState)
{
base.OnAfterInstall(savedState);
string targetDirectory = Context.Parameters["targetdir"];
string tvdbAccountID = Context.Parameters["TVDBACCID"];
// read other config elements...
Properties.Settings.Default.Tvdb_AccountIdentifier = tvdbAccountID;
// set other config elements
Properties.Settings.Default.Save();
}
Any idea how to persist these changes? I already read about Wix but that seems like an overkill to me.
Thanks in advance!