1
votes

I'm trying to create an installer (using WIX 3.11) which can install more instance's of the same program. I have managed to create an installer which does that, but the installer does not work when trying to do an update of the different instances

Here's my code

<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
  <Product Name="ABC Default" Manufacturer="Inc" Language="1033" Version="1.0.1.7"
           Id="*"
           UpgradeCode="{3984A5B2-5CDA-4EC8-933A-089E46E2D688}">
    <Package Id="*" InstallerVersion="200" Compressed="yes" InstallScope="perMachine"
             Keywords="Installer" Description="Installer"
             Comments="Instance installer" Manufacturer="Me"
             Platform="x64"/>

    <Property Id="WIXUI_INSTALLDIR" Value="INSTALLFOLDER" />

    <UI>
      <UIRef Id="WixUI_InstallDir" />

       <!--Skip license dialog--> 
      <Publish Dialog="WelcomeDlg"
                Control="Next"
                Event="NewDialog"
                Value="InstallDirDlg"
                Order="2">1</Publish>
      <Publish Dialog="InstallDirDlg"
                Control="Back"
                Event="NewDialog"
                Value="WelcomeDlg"
                Order="2">1</Publish>
    </UI>    

    <MajorUpgrade AllowSameVersionUpgrades="yes" Schedule="afterInstallInitialize" DowngradeErrorMessage="A later version of [ProductName] is already installed" />
    <MediaTemplate />

    <Property Id="INSTANCEID" Value="0" />

    <InstanceTransforms Property="INSTANCEID" >
      <Instance Id="DEV" ProductCode="*" UpgradeCode="{BB75B4BE-6217-4FDA-8BAC-C46B402AC0FB}" ProductName="ABC Dev" />
      <Instance Id="TEST" ProductCode="*" UpgradeCode="{ACFEFC2F-0D48-4640-9BBC-6E1162F9D1E7}" ProductName="ABC Test" />
   </InstanceTransforms>

    <Feature Id="ProductFeature" Title="Products" Level="1">
      <ComponentGroupRef Id="ProductComponents" />
    </Feature>

    <CustomAction Id="SetInstanceDirectory"
                Property="InstanceDirectory"
                Value="[INSTALLFOLDER][INSTANCEID]\"/>

    <InstallExecuteSequence>
      <Custom Action="SetInstanceDirectory"
                Before="CostFinalize"><![CDATA[InstanceDirectory = ""]]></Custom>
    </InstallExecuteSequence>
  </Product>

  <Fragment>
    <Directory Id="TARGETDIR" Name="SourceDir">
      <Directory Id="ProgramFilesFolder">
        <Directory Id="INSTALLFOLDER" Name="Inc" >
          <Directory Id ="InstanceDirectory" Name="Instance"/>
        </Directory>  
      </Directory>  
    </Directory>
  </Fragment>

  <Fragment>
    <ComponentGroup Id="ProductComponents" Directory="InstanceDirectory">
      <Component Id="NotepadComponent" Guid="{52BCDD67-47F3-4F04-A7F9-6CAB42010CDE}" MultiInstance="yes">
        <File Source="c:\Windows\System32\notepad.exe"/>
      </Component>
    </ComponentGroup>
  </Fragment>

</Wix>

As can be seen the installer is quite simple, but I need some help on the updating part.

Install procedure:

  • msiexec /i test_installer.msi
  • msiexec /i test_installer.msi MSINEWINSTANCE=1 TRANSFORMS=":DEV" /l*vx log.log
  • msiexec /i test_installer.msi MSINEWINSTANCE=1 TRANSFORMS=":TEST" /l*vx log.log

Update procedure:

  • msiexec /i test_installer.msi
  • msiexec /i test_installer.msi TRANSFORMS=":DEV" /l*vx log.log

When trying to update the DEV instance, the installer tries to update the default installation informing the user that the installation is up-to-date and repair or uninstall are possible.

Please help. I have been looking at this problem for more than a week now.

/Kenneth

1

1 Answers

0
votes

MSINEWINSTANCE=1 should be specified always, because your updates are provided as major upgrade.

I just had a look at some code that uses instance transforms. There is no distinction between first install and upgrade install, the command-line is always the same.

This makes sense as a major upgrade is like a new product installation, the only difference being that it automatically removes the older version.