[wix-users] Shortcuts Lost after Major Upgrade

Brian Enderle brianke at gmail.com
Fri Mar 24 07:33:58 PDT 2017


I have a situation where I install version 1 of my program and I have the
expected shortcuts.  I can also install version 2 and have the expected
shotcuts.

However, when I upgrade from version 1 to version 2, the shortcuts are
deleted and not recreated.

Here is the code that should create the shortcuts:

    <ComponentGroup Id="ProductComponents" Directory="INSTALL_FOLDER">
      <Component Id="MyProgramEXE">

        <File Id="MyProgramEXE"
              Source="$(var.MyProgram.TargetDir)MyProgram.exe"
              Vital="yes"
              KeyPath="yes">

          <!-- Create Shortcuts for Admin & regular user in the program
menu dir -->
          <Shortcut Id="ProgramMenuDirShortcutAdmin"
                    Name="$(var.ProductName) - Admin"
                    Description="$(var.ProductName) for the admin"
                    Directory="ProgramMenuFolderCompany"
                    WorkingDirectory="INSTALL_FOLDER"
                    Arguments="Admin"
                    Advertise="yes"
                    Icon="MyIcon.ico"/>

          <Shortcut Id="ProgramMenuDirShortcutUser"
                    Name="$(var.ProductName) - User"
                    Description="$(var.ProductName) for the end user"
                    Directory="ProgramMenuFolderCompany"
                    WorkingDirectory="INSTALL_FOLDER"
                    Advertise="yes"
                    Icon="MyIcon.ico" />
        </File>

        <!-- Remove Start Menu on uninstall -->
        <RemoveFolder Id="RemoveProgramMenuFolderApplication"
Directory="ProgramMenuFolderCompany" On="uninstall" />
      </Component>


The only thing I can think of is I changed the @MajorUpgrade component
between versions so as to preserve user modified files during upgrades:

Version 1:
    <MajorUpgrade Schedule="afterInstallInitialize"
                  DowngradeErrorMessage="A newer version of
$(var.ProductTitle) is already installed." />


Version 2:
    <MajorUpgrade Schedule="afterInstallExecute"
                  AllowSameVersionUpgrades="no"
                  DowngradeErrorMessage="A newer version of
$(var.ProductTitle) is already installed." />


Brian

If you can't explain it simply, you don't understand it well enough.  -
Albert Einstein


More information about the wix-users mailing list