Folder in the program menu folder for WiX 3

Following the code example on the network, I got my first WiX installer. However, he placed a shortcut to my program menu directly in the program menu. I really want to create an Example folder in the Programs menu for my link.

Original code:

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

Attempt to change code (crash on 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 can I add this link to a new folder in the program menu?

+3
source share
2 answers

This is a sample test that I did when I was asked to do the same.

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

+5
source

Windows new 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">
+2

Source: https://habr.com/ru/post/1714724/


All Articles