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