Search code examples
c#installationsettingsinno-setupapplication-settings

Application update removes settings


This is probably something stupid, but when I do an update in my software it doesn't keep the existing application settings.

On each update you have to reset the configuration. How do I get around that?

The settings are set to User scope, the installation is created with an ISS script (Inno Setup)

I hope someone has the answer got quite a lot of unhappy customers :(


Solution

  • Create a Boolean setting for CallUpgrade or something similar

    Set it to true by default

    Then call something like:

    if (Properties.Settings.Default.CallUpgrade)
    {
        Properties.Settings.Default.Upgrade();
        Properties.Settings.Default.CallUpgrade = false;
        Properties.Settings.Default.Save();
    }
    

    That should only run once if the program has updated, since CallUpgrade will be set to true again.

    I don't know how much might have changed for WPF but that is the WinForms version of it, should be very similar.