I like the software to be installed multiple times into different locations. Later on when an upgrader installer runs, it can auto-detect the multiple instances and prompt a list of the instances to let user to pick which one to upgrade.

Right now with the default behavior of InstallBuilder if I run the installer the second time, I can point to a different location, but it overwrites the same Start Menu shortcuts and the ARP shortcuts. And I don't see how I can easily create an upgrader installer that can prompt a list of existing installations.

asked 05 May '12, 04:20

gt8967884's gravatar image

gt8967884
116747678
accept rate: 12%


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>
link

answered 06 May '12, 17:37

juanjo's gravatar image

juanjo ♦♦
5.8k413
accept rate: 23%

Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Tags:

×8
×8
×4
×2

Asked: 05 May '12, 04:20

Seen: 1,396 times

Last updated: 06 May '12, 17:37