代码之家  ›  专栏  ›  技术社区  ›  Eric J.

WIX 3的程序菜单文件夹中的文件夹

  •  4
  • Eric J.  · 技术社区  · 15 年前

    遵循网络上的一些示例代码,我让我的第一个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">
    

    注意添加 样本 .

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

    2 回复  |  直到 15 年前
        1
  •  5
  •   CheGueVerra    15 年前

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

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

        2
  •  2
  •   Shay Erlichmen    15 年前

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

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