2

I have a WIX installer set up for my application and it installs correctly and updates correctly except that it re-writes the default user settings (i.e. defined in properties-> settings) that are defined in my application and corresponding dll's. How can I have WIX update the application, but not update the user settings?

PlTaylor
  • 7,345
  • 11
  • 52
  • 94
  • You might need to elaborate on where and how the properties are installed. Are they installed in files? Are they in registry entries? And what kind of update is it - a patch, major upgrade? If it's a major upgrade where is your RemoveExistingProducts? If it's early in the install then you will be uninstalling all the old files and registry entries and then installing all the new ones. – PhilDW Mar 27 '14 at 16:54
  • These are the settings that are defined in the project. They are referenced in code through Properties.Settings.Default.MySetting and I believe they are stored in the users AppData folder. – PlTaylor Mar 27 '14 at 17:10
  • I forgot to add...these are minor upgrades. – PlTaylor Mar 27 '14 at 17:18

2 Answers2

3

Whether it's ini, registry or xml the concept is simple. Only have the installer responsible for installing defaults settings. Then on first run on your application copy the default settings to the user settings one time. Now the installer will never harm user settings because it doesn't even know of their existence.

Christopher Painter
  • 54,556
  • 6
  • 63
  • 100
  • I think I may have been barking down the wrong path. I believe this answer http://stackoverflow.com/questions/14400943/do-not-overwrite-settings-settings-file-with-clickonce answers my question but won't know until we release our next beta version later today. – PlTaylor Mar 27 '14 at 17:59
  • ClickOnce isn't a Windows Installer technology. – Christopher Painter Mar 27 '14 at 18:00
  • It may not be...but the actual answer points to the fact that the problem is actually in the ApplicationSettingsBase base class of the settings class and not the installer. Or at least that is my understanding of it. – PlTaylor Mar 27 '14 at 18:04
0

Properties -> Settings are mapped to the app.config file for your application, so you can setup the install for that particular file to NeverOverwrite, meaning updates will not overwrite your .config file.

Working example:

<Component Id="SPECTRAVIEW.WPF.MAINAPPLICATION.EXE.CONFIG" Win64="$(var.Win64)" Guid="89E2C6C0-18FB-428B-A9EE-C2FAB3418CB2" NeverOverwrite="yes">
    <File Id="SPECTRAVIEW.WPF.MAINAPPLICATION.EXE.CONFIG" Name="SpectraView.WPF.MainApplication.exe.config" Source="$(var.MainApplication.TargetDir)\SpectraView.WPF.MainApplication.exe.config" KeyPath="yes" />
</Component>
landoncz
  • 1,997
  • 14
  • 15