0
votes

I created an installer using WIX. As part of the installation, two shortcuts (launch and uninstall) are added to "ProgramMenu->MyCompany->MyProductName".

After I install two versions of the same application side by side. I tried to use the uninstall shortcut to uninstall one version.

The uninstall removes all the files and folders for the version. But failed to remove the shortcuts. And when I click on uninstall again. The following error shows:

"This action is only valid for products that are currently installed"

Then I run the uninstall for the other version, this time both shortcuts for THAT version are removed successfully. But leave the shortcuts for the failed version stuck in "ProgramMenu->MyCompany->MyProductName" forever. I had to manually delete them.

Here is the code I use to create the shortcuts. Anything I did wrong?

     <Directory Id="ProgramMenuFolder">
        <Directory Id="MyCompanyShortcutDir" Name="MyCompany">
          <Directory Id="MyProductShortcutDir" Name="MyProduct">
            <Component Id="cmpMyProductShortcut" Guid="*">
              <Shortcut Id="MyAppShortcut" Name="My App" Description="My Application" Target="[INSTALLFOLDER]MyApp.exe" />
              <RemoveFolder Id="RemoveMyCompanyShortcutDir" On="uninstall" Directory="MyCompanyShortcutDir" />
              <RegistryValue Root="HKCU" Key="Software\My Company\My Product\" Name="Installed" Type="integer" Value="1" KeyPath="yes" />
            </Component>
            <Component Id="cmpUninstall" Guid="*">
              <Shortcut Id="UninstallShortcut" Name="Uninstall" Description="Uninstall My App"
                Target="[System64Folder]msiexec.exe" Arguments="/x [ProductCode] /Lv d:\uninstall.log " Directory="MyProductShortcutDir" />
              <RegistryValue Root="HKCU" Key="[Software\My Company\My Product\" Name="Uninstall" Type="integer" Value="1" KeyPath="yes" />
              <RemoveFolder Id="removeShortcut" On="uninstall"/>
            </Component>
          </Directory>
        </Directory>
      </Directory>
1

1 Answers

1
votes

I solved this issue myself, basically two things needed:

  1. Change the ProductCode to *, this allows side-by-side install of two versions.
  2. Make sure the Component Guid for Shortcut to be * as well