Forum Discussion

ChuckBohling's avatar
ChuckBohling
Copper Contributor
Jan 19, 2021

WPF/MSIX application settings not getting updated when new version of the app is installed

I have a WPF app that I'm packaging and publishing (side-loading) with MSIX. Application settings are saved in a class that's derived from ApplicationSettingsBase. When the app is installed and runs, those settings are saved to disk in user.config in a directory something like:

 

C:\Users\...\AppData\Local\Packages\eb585c83...\LocalCache\Local\WpfApp1\WpfApp1_Url_0h0wlkyvmedald25z34yc2xsbwcm4nil\2.0.0.0

 

2.0.0.0 is the app's version number. If I create a new version of the app, 2.0.1.0 for example, a new user.config is created but the settings from version 2.0.0.0 are not copied to the new user.config. The new user.config is in a new directory like:

 

...\LocalCache\Local\WpfApp1\WpfApp1_Url_a3i1rd2xrwh3qbg3x15jaaizhfueup20\2.0.1.0

 

It sounds like ApplicationSettingsBase.Upgrade is supposed to update the new config with settings from the old version but it's not working. If I put the 2.0.0.0 directory in the same directory as 2.0.1.0, then the upgrade works. 

 

If I use Visual Studio's "Deploy" feature, the version directories are in the same parent. I.e. it works. It's publishing/side-loading that has a problem.

 

Any idea what could be wrong?

4 Replies

    • ChuckBohling's avatar
      ChuckBohling
      Copper Contributor

      KevinLa_ms Thanks for the finding that post. Unfortunately, it didn't help.

       

      For my tests, I used Visual Studio 2019 and published (side-loaded) my app as MSIX. The app was built in release (retail?) mode. I first built, published and installed version 1.0.0.0 then built, published and updated version 1.0.1.0. After the update, my LocalCache has two user.config files (1.0.0.0 and 1.0.1.0) but in different directories.