How to support multiple instance installation?

Comments

1 comment

  • Avatar
    juanjo

    The startMenu cna be configured through the <startMenuGroupName> tag and the ARP through the <windowsARPRegistryPrefix>. So you could modify those values at runtime:

    <initializationActionList>
       <actionGroup>
           <actionList>
                <setInstallerVariable name="index" value="1"/>
                <while>
                <actionList>
                    <mathExpression>
                        <text>${index} +1</text>
                        <variable>index</variable>
                    </mathExpression>
                </actionList>
                <conditionRuleList>
                    <registryTest key="HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Uninstall\${project.windowsARPRegistryPrefix} ${index}" logic="exists">
                        <name></name>
                    </registryTest>
                </conditionRuleList>
            </while>
            <setInstallerVariable>
                <name>project.windowsARPRegistryPrefix</name>
                <value>${project.windowsARPRegistryPrefix} ${index}</value>
            </setInstallerVariable>
            <setInstallerVariable>
                <name>project.startMenuGroupName</name>
                <value>${project.startMenuGroupName} ${index}</value>
            </setInstallerVariable>
           </actionList>
           <ruleList>
                <registryTest key="HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Uninstall\${project.windowsARPRegistryPrefix}" logic="exists"/>
           </ruleList>
      </actionGroup>
    </initializationActionList>
    

    To provide a list of choices when upgrading, you could use a <registryFind> and a

    <choiceParameter>
      <name>installationToUpdate</name>
      <description>Select the Application to update</description>
      <displayType>combobox</displayType>
      <ordering>default</ordering>
      <width>40</width>
      <preShowPageActionList>
        <removeChoiceOptions>
          <name>installationToUpdate</name>
          <options></options>
        </removeChoiceOptions>
        <registryFind>
          <findAll>1</findAll>
          <keyPattern>HKEY_LOCAL_MACHINE\Software\${project.windowsSoftwareRegistryPrefix}*</keyPattern>
          <namePattern>Location</namePattern>
          <rootKey>HKEY_LOCAL_MACHINE\Software</rootKey>
          <searchDepth>2</searchDepth>
          <variable>installedPaths</variable>
        </registryFind>
        <setInstallerVariable>
          <name>text</name>
          <value></value>
        </setInstallerVariable>
        <foreach>
          <values>${installedPaths}</values>
          <variables>key name value</variables>
          <actionList>
                <md5 text="${key}" variable="md5"/>
                <setInstallerVariable>
                  <name>text</name>
                  <value>${text}
    ${md5}=${value}</value>
                </setInstallerVariable>
          </actionList>
        </foreach>
        <addChoiceOptionsFromText>
          <name>installationToUpdate</name>
          <text>${text}</text>
        </addChoiceOptionsFromText>
      </preShowPageActionList>
    </choiceParameter>
    

Please sign in to leave a comment.