0

We have a MSI built with wix that installs our ruby based product. When we released the first version there was a bug. Upgrades would overwrite changes to a ruby config file (gemrc), effectively breaking the product in some cases.

I've been trying to get MSI to not remove or replace the config file on upgrades, without success.

What i have now is:

<InstallExecuteSequence>
  <RemoveExistingProducts After="InstallExecuteAgain" />
</InstallExecuteSequence>


  <Directory Id="embeddedDir" Name="embedded">
    <Directory Id="embeddedEtcDir" Name="etc">
      <Component Id="gemrcComponent" Guid="uuid..." NeverOverwrite='yes' Permanent='yes'>
        <File Id='gemrc' Name='gemrc'
              Source='$(var.ProjectSourceDir)\embedded\etc\gemrc.default' Vital='yes' KeyPath='yes' />
      </Component>
    </Directory>

  </Directory>

However, going from the current version (1.0) to the new version (1.1) will leave the installation with no gemrc at all. Going forward it works, so going from 1.1 to 1.2 it leaves the existing (modified) file.

I'm assuming, that the reason it doesn't work is because it uses the old 1.0 MSI to remove the existing installation, and that version has the gemrc file marked as part of the product that needs to be removed.

This means the only way i could get around this is using custom actions (copy the file to a temp path before installation, and then move it back afterwards. Or something similar). Is there a better/easier way?

1
  • Due to the trouble with installer and configuration files we decided in our projects not to install configuration files by the installer. The trouble isn't worth it. Our applications look for existing config files and if they don't exist, create a default file. During removal we ask to keep config files and if no, delete them. Commented Apr 26, 2017 at 9:51

1 Answer 1

2

Some of the reasons you may be seeing this are as follows, but there's not enough information to say which might apply in your cases:

If you originally had a major upgrade scheduled "early" (InstallInitialize or sooner) then the upgrade would completely uninstall the older product and then install the new one. This would look like an overwrite of the config file, but strictly speaking it's not. You do not say if you ever identified the actual root cause of this issue or if the major upgrade was scheduled differently.

In a major upgrade scheduled after InstallExecuteAgain, the upgrade installs on top of the old product and follows file replacement rules. So if the config file had really been updated after install it would not be replaced.

If the component id of the config file changed between any of the setups then you'd see it removed (even in an InstallExecuteAgain upgrade). File sharing is ref counted by component id, so if the upgrade has a component id for the config file that is not the same as the previous installs then you'd see strange behavior because the ref count of the previous file means it would be removed, but you're attempting to install another of the same name with different id.

You should do your upgrades with verbose MSI logging enabled to see what happens to the config file. If it's not clear from that, then post it somewhere accessible for others to look at.

Sign up to request clarification or add additional context in comments.

1 Comment

The component id did change, in that the old version didn't specify that file as a separate component. Also note, the gemrc file in the 1.1 MSI will always have a newer last updated timestamp, since it is generated when the MSI is built.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.