为 WiX 快捷方式设置工作目录 [英] Setting working directory for a WiX shortcut

查看:23
本文介绍了为 WiX 快捷方式设置工作目录的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在设置作为 WiX 脚本一部分创建的快捷方式的工作目录时遇到问题.以下是基础知识:

I'm having trouble setting the working directory of a shortcut created as part of a WiX script. Here are the basics:

<!-- create a start menu shortcut. -->
<Directory Id="ProgramMenuFolder">
  <Directory Id="ApplicationProgramsFolder" Name="My Name">
    <Component Id="ApplicationShortcut" Guid="822A26AF-5231-4EDA-A18D-5DF15020BD94">
      <Shortcut Id="ApplicationStartMenuShortcut"
                Name="My Name"
                Description="My Description"
                Target="[INSTALLLOCATION]My.exe"
                WorkingDirectory="INSTALLLOCATION" />
      <RemoveFolder Id="ApplicationProgramsFolder" On="uninstall"/>
    </Component>
  </Directory>
</Directory>

<!-- Install the app. -->
<Directory Id="ProgramFilesFolder">
  <Directory Id="INSTALLLOCATION" Name="My Name">
    <Component Id="ProductComponent" Guid="4740357A-69D3-4626-A0F7-D0667C93A2CE">
      <File Id="My.exe" Name="My.exe" Source="My.exe" />
    </Component>
  </Directory>
</Directory>

这与我见过的示例相吻合,并且创建了快捷方式,它指向正确的 exe,但快捷方式没有指定工作目录,因此应用找不到其本地资源.

This jives with examples I've seen, and the shortcut gets created, and it points to the right exe, but the shortcut has no working directory specified, and so the app doesn't find its local resources.

推荐答案

你不需要说 [INSTALLLOCATION] 因为 ShortCut 表定义了 WkDir 列描述了具有工作目录路径的属性的名称为快捷方式."

You don't need to say [INSTALLLOCATION] because the ShortCut table defines the WkDir column describes "The name of the property that has the path of the working directory for the shortcut."

我会推荐尝试这个:

<Directory Id="ProgramMenuFolder"> 
  <Directory Id="ApplicationProgramsFolder" Name="My Name"> 
  </Directory> 
</Directory> 

<!-- Install the app. --> 
<Directory Id="ProgramFilesFolder"> 
  <Directory Id="INSTALLLOCATION" Name="My Name"> 
    <Component Id="ProductComponent" Guid="4740357A-69D3-4626-A0F7-D0667C93A2CE"> 
      <File Id="My.exe" Name="My.exe" Source="My.exe" />
        <Shortcut Id="ApplicationStartMenuShortcut" 
                  Advertise="yes"
                  Name="My Name" 
                  Description="My Description" 
                  Directory="ApplicationProgramsFolder"
                  WorkingDirectory="INSTALLLOCATION">
          <Icon Id="My.exe" SourceFile="My.exe" />
        <Shortcut>
    </Component> 
  </Directory> 
</Directory> 

这篇关于为 WiX 快捷方式设置工作目录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆