如何从桌面删除快捷方式?

时间:2012-03-02 13:23:44

标签: wix shortcut orphan

安装程序在桌面上创建2个快捷方式:文件(FS)和互联网快捷方式(IS)。卸载时FS已删除,但IS仍然存在。 然后我评论了FS并进行了测试。 现在它已成功创建和删除。

有什么问题?

    <Directory Id='TARGETDIR' Name='SourceDir'>
        <Directory Id="DesktopFolder" Name="Desktop"/>
        <Directory Id="ProgramMenuFolder" Name="PMenu">
            <Directory Id="ProgramMenuDir" Name="Advertised Shortcut" />
        </Directory>
    </Directory>

    <DirectoryRef Id="DesktopFolder">
<Component Id="ApplicationShortcutConf" Guid="{9FF60FF5-F1A2-413F-98FB-CF7B3101F10F}">
  <Shortcut Id="CompanyUtilConfigurator1"
              Directory="DesktopFolder"
              Advertise="no"
              Name="Company Util Configurator"
              WorkingDirectory="INSTALLDIR"
              Icon="CompanyUtilConfiguratorIcon.exe">
  </Shortcut>
  <RegistryValue Root="HKCU" Key="Software\Company LLC\Company\Util" Name="installed_conf" Type="integer" Value="1" KeyPath="yes"/>

  <RemoveFolder Id="DeleteShortcutFolder1"
              Directory="DesktopFolder"
              On="uninstall" />
</Component>

        <Component Id="ApplicationShortcut" Guid="{77C005A8-63DC-43F1-9081-84157EDED0B3}">
            <Condition><![CDATA[WS_SHORTCUT_NAME<>""]]></Condition>
  <util:InternetShortcut
            Id="Home" 
            Directory="DesktopFolder"
            Name="Company Util" Type="url"
            Target="[WS_SHORTCUT_NAME]"/>
            <RemoveFolder Id="DesktopFolder2"  Directory="DesktopFolder" On="uninstall"/>
            <RegistryValue Root="HKCU" Key="Software\Company LLC\Company\Util" Name="installed" Type="integer" Value="1" KeyPath="yes"/>
        </Component>
    </DirectoryRef>

1 个答案:

答案 0 :(得分:4)

我为您的问题尝试了此代码并且可以正常运行

  

<RegistryKey Root="HKCU" Key="!(wix.Manufacturer)\!(wix.Product)" Action="createAndRemoveOnUninstall">
  <RegistryValue Name="FirstShortCut" Type="integer" Value="1" KeyPath="yes"  />
</RegistryKey>

<Shortcut Id="FirstShortCut" Directory="DeskTopFolder" WorkingDirectory="INSTALLDIR" Advertise="no" Name="ShortCutA" Icon="chk_on.ico"/>

  <Component Id="ShortCutB" Guid="{435CE3D7-047F-4bdb-9CDB-6A2AED1A1303}">
    <RegistryKey Root="HKCU" Key="!(wix.Manufacturer)\!(wix.Product)" Action="createAndRemoveOnUninstall">
      <RegistryValue Name="SecondShortCut" Type="integer" Value="1" KeyPath="yes"  />
    </RegistryKey>

    <util:InternetShortcut Id="SecondShortCut" Name="Second" Target="http://www.stackoverflow.com"/>

  </Component>
</DirectoryRef>

试一试...... 记录安装也总是有帮助的 在命令行中使用它:
msiexec / i [msiname] / l * v [filename]