[wix-users] Merge changes for Config files and IIS settings

Christopher Painter chrpai at iswix.com
Mon Mar 4 10:44:17 PST 2019

Part of my 20 minute talk on this is that MSI was created in the 90s before XML was a thing.  An XML file is essentially an entire registry hive in one file.   The component rules / default versioning rules don't support that.

You can do basic settings migration using  the remember property pattern but that doesn't scale very well.   At the end of the day the best thing to do is keep them separate and make it the applications responsibility to merge the layers together to get the setting.

From: Edwin Castro <egcastr at gmail.com>
Sent: Monday, March 4, 2019 11:23 AM
To: WiX Toolset Users Mailing List
Cc: Christopher Painter
Subject: Re: [wix-users] Merge changes for Config files and IIS settings

I'd recommend Christopher's suggestions as well.

Merging any kind of data is hard but merging structured data is harder. It, of course, can be done but you'll probably need to implement it yourself. You can find tools built-in into editors but those won't help you in an installer. Checkout "A Three-way Merge for XML Documents", below, if you want to get a sense for what you'd need to do and the challenges involved.


If you want to read the entire thesis, then you can find it at


There's a java implementation available there too:


To do any meaningful merging of data you'll need 3 documents, the base document (initial document), the current document (their changes), and the upgrade document (the new changes the installer wants to apply). The algorithm described in x will help create a fourth document (the actual document left on disk at the end of the process) that will contain the merged data. You will still need to make some arbitrary decision for handling conflicts if you cannot provide a mechanism to allow the user to select a resolution for a conflict.

Handling conflicts is probably we're you'd get stuck. I know of literally no installer technology anywhere that actually merges data because you cannot do it successfully 100% of the time without user intervention. It is possible you can succeed a lot of the time but it is impossible to predict because you don't know what changes have been made by users!

Edwin G. Castro

On Mon, Mar 4, 2019 at 7:46 AM Christopher Painter via wix-users <wix-users at lists.wixtoolset.org<mailto:wix-users at lists.wixtoolset.org>> wrote:
If you must meet the "requirements" I don't have any suggestions.  If the requirements are negotiable I can tell you how this would handle this with a prospective customer.

1+2) Keep "stock" / "default" data owned by the installer and "custom" data owned by the user in separate files.    For web.config/app.config this can typically be handled by leveraging the  appSettings file attribute to point to an override file.   Simply put  MSI wasn't designed for meging two sources of truth in an XML file.   This is typically a 20 minute discussion so hit me up if you need more information.

3)  I tell customers to tell their customers that the installer owns the website/application that it creates.  Now basic override / variation points can be supported by leveraging the iis:WebSite ConfigureIfExists=No  but at some point if they need to do something very different then the installer then they should just create their own website pointed to the same document directory and manage it themselves.

I have many customers that ship shrinkwrapped  web applications like this and it always works out for them  keeping it simple this way.

From: wix-users <wix-users-bounces at lists.wixtoolset.org<mailto:wix-users-bounces at lists.wixtoolset.org>> on behalf of Ven H via wix-users <wix-users at lists.wixtoolset.org<mailto:wix-users at lists.wixtoolset.org>>
Sent: Monday, March 4, 2019 4:28 AM
To: WiX Toolset Users Mailing List
Cc: Ven H
Subject: Re: [wix-users] Merge changes for Config files and IIS settings

Does anyone have any inputs? Please help.

On Fri, Feb 22, 2019 at 11:26 AM Ven H <venh.123 at gmail.com<mailto:venh.123 at gmail.com>> wrote:

> I have a business requirement. I know many eyebrows will be raised, but
> unfortunately, I need to achieve this requirement.
> There is an application folder that already exists (which was probably
> installed by some other MSI). Now, I have to install the same application
> folder using my MSI. The application folder has a lot of config files.
> Since the end customer would have made some changes to this config, my MSI
> should not overwrite these files. But, the config file changes from my MSI
> should be merged from my MSI. For this, I think I may have to use a Custom
> Action. However, I have the following challenges / questions.
> 1. If a file already exists and my MSI also has the same file to be
> installed, will the file from MSI overwrite the existing file? If so, can
> this be prevented selectively ( I don't want some selected files like
> config files to be overwritten) by using NeverOverwrite attribute (Will
> NeverOverwrite work on files outside of MSI, i.e., the files already
> present and not installed by MSI or it will work 2nd time when the same MSI
> is being installed or upgraded)?
> 2. Let's say this file is not overwritten and merged using Custom Action,
> what will happen when I run an Upgrade again using my MSI? Will it
> overwrite the other files (config file components will have NeverOverwrite
> attribute and hence they will be spared, I believe)?
> 3. I have similar requirement for IIS (web sites and app pools). They
> might have been created manually or using another MSI. First time, when I
> run my MSI, they should not be recreated since the end customer could have
> updated some settings manually. So, I should be able to merge the changes.
> Please help / advise.

WiX Toolset Users Mailing List provided by FireGiant http://www.firegiant.com/

WiX Toolset Users Mailing List provided by FireGiant http://www.firegiant.com/

More information about the wix-users mailing list