重大升级后未删除程序菜单快捷方式

时间:2013-10-28 05:11:01

标签: wix

我的第一个版本中有这个组件:

<ComponentGroup Id="ProgramMenuComponents" Directory="PROGRAMMENUFOLDER">
  <Component Id="ApplicationShortcut">
    <Shortcut Id="ApplicationStartMenuShortcut" Name="$(var.ProductName)" Icon="icon.ico" Description="$(var.ProductName)" Target="[InstallFolder]$(var.MyApp.TargetFileName)" WorkingDirectory="InstallFolder"/>
    <RemoveFolder Id="PROGRAMMENUFOLDER" On="uninstall"/>
    <RegistryValue Root="HKCU" Key="Software\MyCo\MyApp" Name="installed" Type="integer" Value="1" KeyPath="yes"/>
    <Shortcut Id="UninstallProduct" Name="Uninstall $(var.ProductName)" Target="[SystemFolder]msiexec.exe" Arguments="/x [ProductCode]" Description="Uninstalls $(var.ProductName)" />
  </Component>
</ComponentGroup>

我已删除了下一版本的UninstallProduct元素。现在,当我安装第一个版本时,对第二个版本进行重大升级,然后卸载快捷方式。如何确保在主要升级时删除它(甚至在卸载之前)。主要升级安排afterInstallExecute(必须保持这种情况)。

<MajorUpgrade Schedule="afterInstallExecute"/>

1 个答案:

答案 0 :(得分:1)

通过使用RemoveFile元素删除快捷方式修复:

<ComponentGroup Id="ProgramMenuComponents" Directory="PROGRAMMENUFOLDER">
  <Component Id="ApplicationShortcut">
    <Shortcut Id="ApplicationStartMenuShortcut" Name="$(var.ProductName)" Icon="icon.ico" Description="$(var.ProductName)" Target="[INSTALLFOLDER]$(var.MyApp.TargetFileName)" WorkingDirectory="INSTALLFOLDER"/>
    <RemoveFile Id="RemoveOldUninstallShortcut" On="both" Name="[My shortcut file name].lnk" />
  </Component>
相关问题