如何在 WIX 中将快捷方式目录引用到 PackageGroup 中?

How can I make an reference to a Shortcut Directory into PackageGroup in WIX?

我有这个 TestProduct.wxs 文件,代码如下:

<Wix
    xmlns="http://schemas.microsoft.com/wix/2006/wi"
    xmlns:bal="http://schemas.microsoft.com/wix/BalExtension"
    xmlns:util="http://schemas.microsoft.com/wix/UtilExtension">

    <Fragment>
        <util:RegistrySearch
            Id="ExistsSearch"
            Root="HKLM"
            Key="SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{...}"
            Win64="no"
            Result="exists"
            Variable="IsInstalled" />

    <Variable Name="IssTemplateFile" Type="string" Value="[MediaRootDirectory]\ADMIN.iss" bal:Overridable="no" Persisted="yes" />
    <Variable Name="IssFile" Type="string" Value="" bal:Overridable="no" Persisted="yes" />

        <Feature Id="ProductFeature" Title="WebPageShortcutInstaller" Level="1">
          <ComponentGroupRef Id="ProductComponents" />
        </Feature>

        <SetProperty Id="URL" Value="http://www.google.com" Sequence="execute"  Before="CreateShortcuts" />

      <PackageGroup Id="PackageGroup">
            <ExePackage
                Id="AdministratorPackage"
                SourceFile="..."
                DetectCondition="IsInstalled = 1"
                DisplayName="Administrator"
                InstallCondition="InstallationType ~= InstallationTypeServer OR InstallationType ~= InstallationTypeClient"
                Compressed="yes"
                Cache="no"
                PerMachine="yes"
                Permanent="no"
                Vital="yes"
                InstallCommand="...">

                <ExitCode Value="3010" Behavior="forceReboot" />
                <ExitCode Value="1641" Behavior="forceReboot" />

            </ExePackage>
        </PackageGroup>
    </Fragment>

    <Fragment>
      <Directory Id="TARGETDIR" Name="SourceDir">
        <Directory Id="ProgramFilesFolder">
          <Directory Id="INSTALLFOLDER" Name="WebPageShortcutInstaller" />
        </Directory>
        <Directory Id="DesktopFolder">
          <Directory Id="DesktopShortcutID" />
        </Directory>
      </Directory>
    </Fragment>

    <Fragment>
      <ComponentGroup Id="ProductComponents" Directory="INSTALLFOLDER">
        <Component Id="cmpWebPageShortcut" Guid="{}">
          <Shortcut Directory="DesktopFolder" Id="shortcutWebPage" Name="WEb Page" Description="WebPage" Target="[URL]" Icon="IconDesktop">
            <Icon Id="IconDesktop" SourceFile="favicon.ico" />
          </Shortcut>
          <RemoveFolder Id="removeStartMenuFolder" Directory="DesktopShortcutID" On="uninstall" />
          <RegistryValue Root="HKCU" Key="..." Name="installed" Type="integer" Value="1" KeyPath="yes" />
        </Component>
      </ComponentGroup>
    </Fragment>
</Wix>

我还有另一个 Bundle.wxs,我有一个这样的链:

        <Chain> 

            <!-- Server -->
            <PackageGroupRef Id="PackageGroup" />
            <RollbackBoundary />
...
        </Chain> 

我想调用我的 Bundle.wxs PackageGroup 并同时在桌面上创建图标。 当我尝试安装 PackageGroup 时,WIX 安装程序运行良好。我的主要问题是在桌面上创建图标。我不知道为什么没有创建。来自 Feature IDComponentGroupRef 不工作。

我把这段代码变成另一种形式,我用 Product.wxs 创建了一个 MSI,一切正常。

<?xml version="1.0" encoding="UTF-8"?>
    <Wix xmlns="http://schemas.microsoft.com/wix/2006/wi" 
         xmlns:util="http://schemas.microsoft.com/wix/UtilExtension">
      
        <Product Id="*" Name="WebPageShortcutInstaller" Language="1033" Version="1.0.0.0" Manufacturer="Waters" UpgradeCode="...">
            <Package InstallerVersion="200" Compressed="yes" InstallScope="perMachine" />
    
            <MediaTemplate EmbedCab="yes" />
    
            <Feature Id="ProductFeature" Title="WebPageShortcutInstaller" Level="1">
                <ComponentGroupRef Id="ProductComponents" />
            </Feature>
    
        <SetProperty Id="URL" Value="http://www.google.com" Sequence="execute"  Before="CreateShortcuts" />
    
      </Product>   
        <Fragment>
            <Directory Id="TARGETDIR" Name="SourceDir">
                <Directory Id="ProgramFilesFolder">
                    <Directory Id="INSTALLFOLDER" Name="WebPageShortcutInstaller" />
                </Directory>
          <Directory Id="DesktopFolder">
            <Directory Id="DesktopShortcutID" />
          </Directory>
            </Directory>
        </Fragment>      
        <Fragment>
            <ComponentGroup Id="ProductComponents" Directory="INSTALLFOLDER">
          <Component Id="cmpWebPageShortcut" Guid="...">
            
            <Shortcut Directory="DesktopFolder" Id="shortcutWebPage" Name="Web Page" Description="WebPage" Target="[URL]" Icon="IconDesktop">
              <Icon Id="IconDesktop" SourceFile="favicon.ico" />
            </Shortcut>
                 
            <RemoveFolder Id="removeStartMenuFolder" Directory="DesktopShortcutID" On="uninstall" />
            <RegistryValue Root="HKCU" Key="Software\..." Name="installed" Type="integer" Value="1" KeyPath="yes" />
          </Component>
            </ComponentGroup>
        </Fragment>
    </Wix>

注意:必须使用PackageGroup因为我需要调用id到.我只是想为第一个选项做一个正确的形状。

Bundles 不支持快捷方式或组件。他们需要进入 Product.