【问题标题】:Shortcut using WIX使用 WIX 的快捷方式
【发布时间】:2016-03-08 22:19:28
【问题描述】:

我有一个安装程序,它在目标目录中创建一个文件夹“_source”,其中包含“SAMPLE.exe”和其他文件。我正在尝试生成一个指向该 exe 的快捷方式,但它似乎生成/复制该 exe 并将其放置在目标目录中。它能够运行可执行文件,但由于 _source 目录中需要其他文件,因此无法继续。如何在不复制该 exe 的情况下指向 _source 中的 exe?

<Directory Id="TARGETDIR" Name="SourceDir">
       <Directory Id="DesktopFolder" SourceName="Desktop"/>
          <Directory Id="MergeRedirectFolder">
             <Component Id="ApplicationShortcut" Guid="1D120AC7-6BAC-4F99-8611-029ED3F2EA3A">
             <File Id="MyExeFile" Source="!(wix._source)\SAMPLE.exe" KeyPath="yes">
             <Shortcut Id="DesktopShortcut" Directory="DesktopFolder" Name="SAMPLE" WorkingDirectory="MergeRedirectFolder"
                 Icon="SAMPLE.exe"
                 IconIndex="0"
                 Advertise="yes" >
                 <Icon Id="SAMPLE.exe" SourceFile="!(wix._source)\icon1.ico" />
             </Shortcut>
           </File>
         </Component>
      </Directory>

【问题讨论】:

  • 您的桌面上有 MergeRedirectFolder 吗?您似乎正在尝试将其安装到桌面上的文件夹中。
  • SAMPLE.exe 安装在位于 targetdir 的“_source”下。我想在桌面上有快捷方式,指向 _source 文件夹中的 exe。使用上面的代码,它不会在桌面创建文件夹,它只是创建一个快捷方式,但似乎没有指向来自 _source 的 exe。
  • 它创建了一个 SAMPLE.exe 的副本并将其放置在 _source 之外的 targetdir 中。

标签: wix exe shortcut


【解决方案1】:

如果您尝试在程序文件下安装,我会从以下内容开始:

<Product ...>
...
<Feature ...>
    <ComponentGroupRef Id="ProductComponents" />
</Feature>
<Icon Id="SAMPLE.ico" SourceFile="!(wix._source)\icon1.ico" />
</Product>

<Directory Id="TARGETDIR" Name="SourceDir">
    <Directory Id="ProgramFilesFolder">
        <Directory Id="MergeRedirectFolder" />
    </Directory>

    <Directory Id="DesktopFolder" SourceName="Desktop"/>        
</Directory>

<ComponentGroup Id="ProductComponents" Directory="MergeRedirectFolder">
    <Component Id="ApplicationShortcut" Guid="1D120AC7-6BAC-4F99-8611-029ED3F2EA3A">
        <File Id="MyExeFile" Source="!(wix._source)\SAMPLE.exe" KeyPath="yes">
            <Shortcut Id="DesktopShortcut" Directory="DesktopFolder" Name="SAMPLE" WorkingDirectory="MergeRedirectFolder"
             Icon="SAMPLE.ico"
             IconIndex="0"
             Advertise="yes" />
        </File>
    </Component>
</ComponentGroup>

【讨论】:

    猜你喜欢
    • 2012-08-05
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-06-23
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多