Avatar of dominicwong
dominicwong

asked on 

Trouble with persisting user settings when install new version

Hi experts
I have some trouble in restoring persisted user config settings when installing a new version of my C# .NET application.

I have the following lines right at the beginning of my main program:
       // if(Properties.Settings.Default.UpgradeSettings). Temporary took out for testing
       {
                Properties.Settings.Default.Upgrade();
                Properties.Settings.Default.UpgradeSettings = false;
                Properties.Settings.Default.Save();
        }

Open in new window


The old settings was kept in the file "user.config" at the location:
C:\Users\dwong\AppData\Local\Company\MyTool.exe_Url_bp2u4og4vwazxwbxllvfhrz3ph3omcfd\1.1.0.4

After installing the new version, I could see a new "user.config" at a new location:
C:\Users\dwong\AppData\Local\Company\MyTool.exe_Url_pjgudcgzuigkvokmjnwldqaecw2hgaz5\1.1.0.5

But the code above didn't copy the old user settings, could someone point to me where I might have done wrong.

FYI, I am using C#, .NET 3.5, Installer.

Thanks in advance.
C#.NET ProgrammingInstallation

Avatar of undefined
Last Comment
dominicwong

8/22/2022 - Mon