0

We're making a project that is primarily a Windows Service EXE. We're using WIX (with heat) to create an installer, that creates the relevant files and registers the EXE with Windows Services.

We've got to the point of implementing the installer upgrade logic, which largely JustWorks(TM) by setting the Version attribute of the Product tag in the .wxs file.

One issue that I can't see how to manage is the config files of the tool.

The tool has various config settings that can be modified from within the tool. We're using ASP.NET, which has built in settings/config management, and the config settings that get changed are declared as "User" settings. When we run the save the config changes, it creates a secondary config file which overrides the default settings in the primary config file.

The primary config file exists at <installRoot>\MyCustomService.exe.config, and the secondary config file is at <complicated\Path>\vX.Y.Z\user.config. Where X.Y.Z is the AssemblyInfo version number which is held in sync with the WIX Version number.

When we install a new version, the tool starts looking in a new path for the user.config ... and can't find it. So functionally, installing a new version resets all of the user's configuration :( .


What is the appropriate way to get a WIX upgrade installation to maintain the existing config?

Brondahl
  • 7,402
  • 5
  • 45
  • 74

1 Answers1

1

ASP.NET config supports upgrading user settings from one version to the next, using the .Upgrade() method. You're better off using that rather than manage this in the installer.

This question has details on how to manage that: How do you keep user.config settings across different assembly versions in .net?

but the core solution is:

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

Having created UpdateRequired as a user property existing only to manage this process

timwoods36
  • 26
  • 2