WIX只创建了目录中的最后一个快捷方式

时间:2012-11-26 23:44:17

标签: wix windows-installer wix3.5

我有以下WIX(3.7)代码(一般化)问题是当我添加多个快捷方式时,只安装了最后一个。我检查了日志,它只执行了CreateShortcut的单个实例...

 <Directory Id="ProgramMenuFolder">
                <Directory Id="company_StartMenu" Name="company">
                    <Component Guid="FBF1EE90-789F-4891-BF3D-C73E6E786BA3" Id="comapny_StartMenu">
                        <CreateFolder />
                        <RemoveFolder Id="company_StartMenu" On="uninstall" />
                    </Component>
                    <Directory Id="AppDir_StartMenu" Name="app">
                        <Component Guid="93ECCEED-C0B6-46B5-ADA6-3E45BD0A1B2C" Id="AppDir_StartMenu">
                            <CreateFolder />
                            <RemoveFolder Id="AppDir_StartMenu" On="uninstall" />
                            <Shortcut Id="__radDD6BE_STARTSHORTCUT" Name="app" Description="Start app"  Target="runtime.exe" Advertise="no">
                                <Icon Id="___radDD6BE_STA" SourceFile="C:\path\appicon.ico" />       </Shortcut>
                            <Shortcut Id="__rad5206D_openfolder"    Name="Open folder"   Description="Open install folder " Target="[INSTALLDIR]" Advertise="no"></Shortcut>
                        </Component>
                    </Directory>
                </Directory>
            </Directory>

1 个答案:

答案 0 :(得分:0)

使用此示例代码,我可以在安装

时添加两个快捷方式

A)应用的快捷方式 B)ShortCut链接到安装文件夹

<DirectoryRef Id="ApplicationProgramsFolder">
  <Component Id="ApplicationShortCutA" Guid="{D5318419-F1C2-4D4A-9F21-7DD8C9916426}">

    <Shortcut  Id="AppShortCutA" Name="!(wix.Product)"
              Description="!(wix.ProductDesc)"
              Target="[INSTALLDIR]SomeFileA.txt"
              WorkingDirectory="INSTALLDIR" />


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

    <RemoveFolder Id="ApplicationShortCutA" On="uninstall"/>
  </Component>

  <Component Id="OpenFolderShortCut" Guid="{5596B2C5-A460-439d-838E-4B134EE6FDD1}">
    <CreateFolder />
    <Shortcut Id="OpenFolderLink" Name="Open Folder"
              Description="Open install Folder" Target="[INSTALLDIR]"
              Advertise="no" WorkingDirectory="INSTALLDIR" />

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

    <RemoveFolder Id="OpenFolderShortCut" On="uninstall"/>
  </Component>
</DirectoryRef>
HTH
PS没有验证卸载;)