2

我有以下情况。

我的产品将二进制文件安装在内部c:\Program Files (x86)\MyCompany\MyApp\,并在C:\ProgramData\Microsoft\Windows\Start Menu\Programs\MyCompany.

我使用这个很好的例子构建了 msi:https ://helgeklein.com/blog/2014/09/real-world-example-wix-msi-application-installer/

我刚刚添加了以下代码

  <!-- ApplicationShortcut-->
  <Directory Id="ProgramMenuFolder">

    <Directory Id="ApplicationProgramsFolder" Name="!(loc.ManufacturerName)">

      <Component Id="ApplicationShortcut" Guid="F4B7EAFA-FF19-41B4-8267-3AEFC12235A7">
        <Shortcut Id="ApplicationStartMenuShortcut"
             Name="!(loc.ApplicationName)"
             Description="!(loc.ProductDescription)"
             Target="[INSTALLDIR]MyApp.exe"
             WorkingDirectory="INSTALLDIR"
    />
        <RemoveFolder Id="RemoveApplicationProgramsFolder" Directory="ApplicationProgramsFolder" On="uninstall"/>
        <RegistryValue Root="HKCU" Key="Software\!(loc.ManufacturerName)\!(loc.ApplicationName)" Name="installed" Type="integer" Value="1" KeyPath="yes"/>
      </Component>

    </Directory>

  </Directory>

问题如下

  • 我第一次安装应用程序,它会安装快捷方式就好了
  • 现在我启动应用程序并选择Pin to taskbar, this will create a shortcut inC:\Users\\AppData\Roaming\Microsoft\Internet Explorer\Quick Launch\User Pinned\TaskBar`
  • 如果我重建 msi 并再次执行设置,任务栏快捷方式不再可点击,因为C:\Users\<user>\AppData\Roaming\Microsoft\Internet Explorer\Quick Launch\User Pinned\TaskBar缺少快捷方式

是否可以在更新期间维护任务栏快捷方式?

4

1 回答 1

1

我在这里找到了答案:https ://stackoverflow.com/a/33402698/98491

<InstallExecuteSequence>
  <RemoveShortcuts>Installed AND NOT UPGRADINGPRODUCTCODE</RemoveShortcuts>
</InstallExecuteSequence>

这可以防止在更新期间卸载快捷方式。

如评论中所述,缺点是卸载后,TaskBarShortCut 仍然存在,但这是用户可能期望的。每次更新软件时都不必重新创建固定的任务栏快捷方式。

于 2018-12-10T10:35:37.243 回答