簡體   English   中英

WiX安裝程序刪除升級時的快捷方式

[英]WiX Installer removes shortcut on upgrade

我正在使用WiX Toolkit v3.11來創建我的軟件設置。 在安裝過程中,我使用以下代碼創建startmenu快捷方式:

<Shortcut Id='startmenuMyProgram'
          Name='$(var.MyProgramName)'
          Directory='ProgramMenuFolder'
          WorkingDirectory='APPLICATIONFOLDER'
          Advertise='yes'
          Icon='icon.exe'>
  <Icon Id='icon.exe' SourceFile='$(var.Setuppath)\MyProgram.exe'/>
</Shortcut>

通過這種方式,我還為其他可執行文件創建了兩個快捷方式。 現在為了卸載我想刪除快捷方式。

<Component Id="removeStartmenuShortcuts" Guid="803ad14a-feab-4901-b9db-2c4a1298ae8b">
  <Condition>(REMOVE=ALL) AND NOT (WIX_UPGRADE_DETECTED OR UPGRADINGPRODUCTCODE)</Condition>

  <RemoveFile Id="remove_startmenuProgram1" Name="startmenuMyProgram" On="uninstall" />
  <RemoveFile Id="remove_startmenuProgram2" Name="startmenuMyProgram2" On="uninstall"/>
  <RemoveFile Id="remove_startmenuProgram3" Name="startmenuMyProgram3" On="uninstall"/>
</Component>

卸載軟件時,這沒有任何問題。 但是,執行更新時也會刪除快捷方式。 但我想阻止這種行為,但條件似乎不起作用。 因此,當我進行更新時,將刪除Windows任務欄中的所有快捷方式。

如何使更新進度正常工作?

這里更新后的行為:

執行更新時的行為

右側所有快捷方式的組都丟失了!

您可以組合2個組件。 這樣您就不需要使用條件語句了。

注冊表值是在組件下設置鍵路徑。

  <Component Id="cmpstartmenuMyProgram" Guid="{67CB4F7A-5028-4697-A47F-DE99110B9645}">
    <Shortcut Id="Shortcut.ApplicationName"
              Name="ApplicationName"
              Target="[INSTALLDIR]ApplicationName.exe"
              WorkingDirectory="INSTALLDIR"
              Directory="StartMenuFolder"
              Icon="Icon.exe"/>
    <RemoveFile Id="RemoveStartMenuShortcut.ApplicationName" Name="ApplicationName" Directory="StartMenuFolder" On="uninstall"/>
    <RegistryValue Root="HKCU" Key="Software\Compony\ComponyName" Name="installed" Type="integer" Value="1" KeyPath="yes"/>
  </Component>

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM