0

The following steps had been performed:

  1. Setup1.msi had been built in VS2005 + WiX 3.0 (.NET Framework 2.0).
  2. Version 1.0.0.0 had been installed by Setup1.msi.
  3. For the purpose of minor upgrade a Setup2.msi had been built (Setup2.msi differs from Setup1.msi ONLY in ProductVersion="1.0.1.0")
  4. The following Patch.wxs had been prepared:

    <Patch
        AllowRemoval="no"
        Classification="Update"
        Comments="..."
        Description="..."
        DisplayName="..."
        Manufacturer="..."
        TargetProductName="...">
    
    <Media Id="1000" Cabinet="MyPatch.cab">
        <PatchBaseline Id="MyPatch" />
    </Media>
    
    <PatchFamily 
        Id="MyPatchFamily" 
        Version="1.0.1.0" 
        ProductCode="...THE SAME AS IN Setup1.msi..."            
        Supersede="yes">
    
        <ComponentRef Id="CMP_Program_EXE" />      
        <ComponentRef Id="CMP_Desktop_Shortcut" />      
        <ComponentRef Id="CMP_ProgramMenu_Shortcut" />
    </PatchFamily>
    </Patch>
    
  5. Patch.msp had been created with help of candle, light, torch and pyro.exe.

  6. The following command had been invoked:

    msiexec /p Patch.msp REINSTALL=ALL REINSTALLMODE=vomus
    

    As a result, Program.exe was updated and new shortcuts "v. 1.0.1" were created. However, old Shortcut "v. 1.0.0" remained both on "DesktopFolder" and on "ProgramMenuFolder".

    How can I make the Patch remove old Shortcut?
    Thanks in advance.

user536443
  • 11
  • 3

2 Answers2

1

The simplest way is not to add version to shortcut name. See Windows UX Guidelines:

Avoid putting a version number in a program name unless that is how users normally refer to your program.


Otherwise your minor upgrade has to remove the shortcut to the old version and create a new shortcut that points to the new version.

During minor upgrade, the old version does not get uninstalled, that's why the shortcut is not updated.

Alexey Ivanov
  • 11,541
  • 4
  • 39
  • 68
0

You can use the RemoveFile element within the Component one owning the Shortcut:

<DirectoryRef Id="DesktopFolder">
  <Component Id="..." Guid="...">
    <Shortcut Id="..." Name="foobar_1.0.1" ... />
    <RemoveFile Id="..." Name="foobar_1.0.0.lnk" On="install" />
    ...
  </Component>
</DirectoryRef>

But. There's one problem remained -- when you uninstall you MSP patch, new shortcut (foobar_1.0.1.lnk) is not removed (because the Shortcut table is transformed back, I believe). Therefore, user ends up with two shortcuts. I do not know how to fix that, therefore I asked here.

Ruslan Garipov
  • 530
  • 4
  • 13