WiX 3 程序菜单文件夹内的文件夹

发布于 2024-07-30 11:53:01 字数 624 浏览 2 评论 0原文

按照网上的一些示例代码,我让我的第一个 WiX 安装程序运行起来。 但是,它将我的程序菜单快捷方式直接放在程序菜单上。 我真的想在程序菜单中为我的链接创建一个文件夹 Sample。

原始代码:

<Shortcut Id="startmenuSample" Directory="ProgramMenuFolder" Name="Sample 0.5"
WorkingDirectory='INSTALLDIR' Icon="Sample.exe" IconIndex="0" Advertise="yes">

尝试修改代码(因编译器错误而失败):

<Shortcut Id="startmenuSample" Directory="ProgramMenuFolder\Sample" Name="Sample 0.5"
WorkingDirectory='INSTALLDIR' Icon="Sample.exe" IconIndex="0" Advertise="yes">

请注意添加了\Sample

如何将该链接添加到程序菜单中的新文件夹?

Following some example code on the net, I got my first WiX installer to work. However, it placed my program menu shortcut directly on Program Menus. I really want to create a folder, Sample, in Program Menus for my link.

Original Code:

<Shortcut Id="startmenuSample" Directory="ProgramMenuFolder" Name="Sample 0.5"
WorkingDirectory='INSTALLDIR' Icon="Sample.exe" IconIndex="0" Advertise="yes">

Attempt at modifying code (fails with compiler error):

<Shortcut Id="startmenuSample" Directory="ProgramMenuFolder\Sample" Name="Sample 0.5"
WorkingDirectory='INSTALLDIR' Icon="Sample.exe" IconIndex="0" Advertise="yes">

Note the addition of \Sample.

How do I go about adding that link to a new folder in the Program Menu?

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

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

发布评论

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

评论(2

找个人就嫁了吧 2024-08-06 11:53:01

这是我做的一个示例测试,当我被要求做同样的事情时

<Package InstallerVersion="200" Compressed="yes" />

<WixVariable Id="Manufacturer" Value="StackOverFlowHelper"/>
<WixVariable Id="ShortProduct" Value="ShortCuts"/>

<Media Id="1" Cabinet="WixShortCut.cab" EmbedCab="yes" />

<Icon Id="ShortCutIcon" SourceFile="YOUR.ico"/>

<!-- The icon that appears in Add & Remove Programs. -->
<Property Id="ARPPRODUCTICON" Value="ShortCutIcon" />

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

    <Directory Id="ManufacturerFolder" Name="!(wix.Manufacturer)">
      <Directory Id="INSTALLLOCATION" Name="!(wix.ShortProduct)">
        <Component Id="ProductComponent" Guid="{YOUR_GUID}" KeyPath="yes">
          <CreateFolder/>
        </Component>
      </Directory>
    </Directory>
    <Directory Id="ProgramMenuFolder">
      <Directory Id="ProgramMenuManufacturer" Name="!(wix.ShortProduct)" />
    </Directory>
  </Directory>
</Directory>



<DirectoryRef Id="ProgramFilesFolder">
  <Component Id="ProgramMenuShortcuts" Guid="{YOUR_GUID}">
    <CreateFolder Directory="ProgramMenuManufacturer"/>
    <RemoveFolder Id="RemoveMenuShortcuts" Directory="ProgramMenuManufacturer" On="uninstall" />

    <RegistryValue Root="HKCU" Key="Software\!(wix.Manufacturer)\!(wix.ShortProduct)" Name="InstalledStartMenuShortcuts" Type="integer" Value="1" />
  </Component>
</DirectoryRef>

<DirectoryRef Id="INSTALLLOCATION" FileSource="Files">
  <Component Id="WixShortCut" Guid="{YOUR_GUID}">
    <File Id="Test.ShortCut" Vital="yes" Name="A_DOC.pdf" />

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

    <!-- Shortcut in Start menu. -->
    <Shortcut Id="ProgramMenuApplicationShortcut" Name="!(wix.ShortProduct)" Target="[#Test.ShortCut]"
                        Directory="ProgramMenuManufacturer" Show="normal" Icon="ShortCutIcon"/>
  </Component>
</DirectoryRef>

<Feature Id="ProductFeature" Title="WixShortCuts" Level="1">
  <ComponentRef Id="ProductComponent"/>
  <ComponentRef Id="ProgramMenuShortcuts"/>
  <ComponentRef Id="WixShortCut"/>
</Feature>

This is a sample test I did, when I was asked to do the same thing

<Package InstallerVersion="200" Compressed="yes" />

<WixVariable Id="Manufacturer" Value="StackOverFlowHelper"/>
<WixVariable Id="ShortProduct" Value="ShortCuts"/>

<Media Id="1" Cabinet="WixShortCut.cab" EmbedCab="yes" />

<Icon Id="ShortCutIcon" SourceFile="YOUR.ico"/>

<!-- The icon that appears in Add & Remove Programs. -->
<Property Id="ARPPRODUCTICON" Value="ShortCutIcon" />

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

    <Directory Id="ManufacturerFolder" Name="!(wix.Manufacturer)">
      <Directory Id="INSTALLLOCATION" Name="!(wix.ShortProduct)">
        <Component Id="ProductComponent" Guid="{YOUR_GUID}" KeyPath="yes">
          <CreateFolder/>
        </Component>
      </Directory>
    </Directory>
    <Directory Id="ProgramMenuFolder">
      <Directory Id="ProgramMenuManufacturer" Name="!(wix.ShortProduct)" />
    </Directory>
  </Directory>
</Directory>



<DirectoryRef Id="ProgramFilesFolder">
  <Component Id="ProgramMenuShortcuts" Guid="{YOUR_GUID}">
    <CreateFolder Directory="ProgramMenuManufacturer"/>
    <RemoveFolder Id="RemoveMenuShortcuts" Directory="ProgramMenuManufacturer" On="uninstall" />

    <RegistryValue Root="HKCU" Key="Software\!(wix.Manufacturer)\!(wix.ShortProduct)" Name="InstalledStartMenuShortcuts" Type="integer" Value="1" />
  </Component>
</DirectoryRef>

<DirectoryRef Id="INSTALLLOCATION" FileSource="Files">
  <Component Id="WixShortCut" Guid="{YOUR_GUID}">
    <File Id="Test.ShortCut" Vital="yes" Name="A_DOC.pdf" />

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

    <!-- Shortcut in Start menu. -->
    <Shortcut Id="ProgramMenuApplicationShortcut" Name="!(wix.ShortProduct)" Target="[#Test.ShortCut]"
                        Directory="ProgramMenuManufacturer" Show="normal" Icon="ShortCutIcon"/>
  </Component>
</DirectoryRef>

<Feature Id="ProductFeature" Title="WixShortCuts" Level="1">
  <ComponentRef Id="ProductComponent"/>
  <ComponentRef Id="ProgramMenuShortcuts"/>
  <ComponentRef Id="WixShortCut"/>
</Feature>

没有你我更好 2024-08-06 11:53:01

在 Windows Installer 中,您需要在 ProgramMenuFolder 下创建一个 new 目录,然后引用它。

<Directory Id="ProgramMenuFolder" >
  <Directory Id="ProgramMenuDir" Name='My Folder'>
  </Directory>
</Directory>

<Shortcut Id="startmenuSample" Directory="ProgramMenuFolder" Name="Sample 0.5"
  WorkingDirectory='INSTALLDIR' Icon="Sample.exe" IconIndex="0" Advertise="yes">

In Windows Installer you need to create a new directory under ProgramMenuFolder and then reference it.

<Directory Id="ProgramMenuFolder" >
  <Directory Id="ProgramMenuDir" Name='My Folder'>
  </Directory>
</Directory>

<Shortcut Id="startmenuSample" Directory="ProgramMenuFolder" Name="Sample 0.5"
  WorkingDirectory='INSTALLDIR' Icon="Sample.exe" IconIndex="0" Advertise="yes">
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文