0

I am creating a Microsoft Installer (.msi file) using the Wixtoolset (Windows Installer XML). This installer must automate the installation of an existing .exe program (named installer.exe below) and copy a custom configuration file (named settings.conf below) to the target directory. In addition the installer must modify the configuration file using the InstallFiles command below. But the timing of events is critical. If the executable installer runs too early, it fails or exhibits strange behavior. And if the executable installer run too late in the install sequence, it overwrites my modified configuration file with the generic values. I believe this can be done by assigning a string to the Before or After property value. What Before or After property assignment will allow the executable to run properly but not overwrite the configuration file I moved by the CopyFile element? Here is my Wixtoolset XML code.

        <Property Id="CONFIGFOLDER"  Value="C:\acme\config" >
        <Feature
            Id="ConfigurationFile" 
            Title="Configuration File" 
            Level="1"
            <ComponentRef Id="CMP_ACME_Config_File" />
        </Feature>
        <DirectoryRef Id="TARGETDIR">
            <Component Id="CMP_ACME_Config_File" Guid="">
                <File
                    Id="ACME_Config" 
                    Source="MySettings.conf" 
                    KeyPath="yes"
                    <CopyFile Id="Copy_ACME_Config" 
                    DestinationProperty="CONFIGFOLDER" 
                    DestinationName="settings.conf" />
                </File>
            </Component>
        </DirectoryRef>
        <Binary 
            Id="InstallerEXE"    
            SourceFile="installer.exe" />
        <CustomAction 
            Id="Launch_Installer" 
            BinaryKey="InstallerEXE" 
            Impersonate="yes"  
            Execute="deferred" 
            ExeCommand=""
            Return="check" />
        <InstallExecuteSequence>
            <Custom Action="Launch_Installer" 
                Before="InstallFiles">
            </Custom>
        </InstallExecuteSequence>
    </Property>
skinnedknuckles
  • 371
  • 3
  • 12
  • 1
    Does the EXE file wrap another MSI file? There are technical reasons why you can not install two MSI files at the same time. You could also consider using Burn - the WiX bootstrapper / sequencer / chainer which will allow you to run the executable entirely before your MSI - if that works for you. It is often effective to update configuration files on first application launch - and even to generate the real config file at that time so it is de-coupled from deployment entanglement. You can install a read-only copy of the config file to use as a template. – Stein Åsmul Sep 28 '18 at 01:23
  • I don't believe the exe contains another MSI installer. Yes, I read elsewhere that the Wix bootstrapper is the proper way to handle this circumstance. The read-only copy idea is a good one too. – skinnedknuckles Oct 02 '18 at 17:34

1 Answers1

0

I can't explain exactly why this works but assigning "InstallFiles" to the "After" property in the "Custom" element seems to do the trick.

     <InstallExecuteSequence>
         <Custom Action="Launch_Installer" 
             After="InstallFiles">
         </Custom>
     </InstallExecuteSequence>
skinnedknuckles
  • 371
  • 3
  • 12