设置 WiX 快捷方式的工作目录

发布于 2024-09-26 01:59:56 字数 1115 浏览 1 评论 0原文

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

<!-- 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>

这个 jives 包含我见过的示例,并且创建了快捷方式,并且它指向正确的 exe,但快捷方式没有指定工作目录,因此应用程序找不到其本地资源。

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>

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.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

清风无影 2024-10-03 01:59:56

您不需要说 [INSTALLLOCATION],因为 ShortCut 表定义 WkDir 列描述“具有快捷方式工作目录路径的属性的名称”。

我建议尝试这个:

<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> 

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."

I would reccomend trying this:

<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> 
眼眸 2024-10-03 01:59:56

我认为您需要在工作目录属性中的 INSTALLLOCATION 周围加上方括号。

I think you need square brackets around your INSTALLLOCATION in the working directory attribute.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文