Wix Installer start menu shortcut not appearing
Asked Answered
A

2

7

I am trying to create an installer project for a windows application using WiX v3.7 (as VS2012 does not include setup and deployment projects any more) for learning purposes. Wix toolset is entegrated to VS and I am creating a new WiX single installer setup project. The installer is always compiled succesfully (except for warnings in icon extension), it runs perfect and places desktop shortcuts as they should be, but fails to put proper start menu shortcuts on Windows 7 Professional x64 Service Pack 1. I searched the web and tried almost anything I see, but so far no success. The product.wxs file is as follows and "my_guid" strings are replaced by proper GUIDS in the project. Clearly I am missing a point but cannot see where. The registry key is not created as well, so the last fragment is possibly not executed for a reason. How could this be solved?

<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
    <Product Id="my_guid" Name="WixSingleSetupExample" Language="1055" Version="1.0.0.0" Manufacturer="Can Yucel" UpgradeCode="my_guid">
        <Package InstallerVersion="200" Compressed="yes" InstallScope="perMachine" />

        <MajorUpgrade DowngradeErrorMessage="A newer version of [ProductName] is already installed." />
        <MediaTemplate />

        <Feature Id="ProductFeature" Title="WixSingleSetupExample" Level="1">
            <ComponentGroupRef Id="ProductComponents" />
            <ComponentRef Id="ApplicationShortcut" />
        </Feature>
    </Product>

    <Fragment>
        <Directory Id="TARGETDIR" Name="SourceDir">
            <Directory Id="DesktopFolder" Name="Desktop" />
            <Directory Id="ProgramMenuFolder">
                <Directory Id="ApplicationProgramsFolder" Name="WixSingleSetup"/>
            </Directory>
            <Directory Id="ProgramFilesFolder">
                <Directory Id="INSTALLFOLDER" Name="WixSingleSetupExample" />
            </Directory>
        </Directory>
    </Fragment>

    <Fragment>
        <ComponentGroup Id="ProductComponents" Directory="INSTALLFOLDER">
          <!-- TODO: Remove the comments around this Component element and the ComponentRef below in order to add resources to this installer. -->
          <Component Id="ProductTextFile">
              <File Source="blankText.txt" KeyPath="yes">
                  <Shortcut Id="desktopShortcut" Advertise="yes" Directory="DesktopFolder" Name="WixSingleSetup Help" WorkingDirectory="INSTALLFOLDER" Icon="icon1.txt" IconIndex="0">
                      <Icon Id="icon1.txt" SourceFile="blankText.txt"/>
                  </Shortcut>
              </File>      
          </Component>
        </ComponentGroup>
    </Fragment>

  <Fragment>
    <DirectoryRef Id="ApplicationProgramsFolder">
      <Component Id="ApplicationShortcut" Guid="my_guid">
        <Shortcut Id="ApplicationStartMenuShortcut"
                  Name="WixSingleSetup Help"
                  Description="Setup Example"
                  Target="blankText.txt"
                  WorkingDirectory="INSTALLFOLDER"
                  Icon="icon2.txt"
                  IconIndex="0">
          <Icon Id="icon2.txt" SourceFile="blankText.txt"/>
        </Shortcut>
        <RemoveFolder Id="ApplicationProgramsFolder" On="uninstall"/>
        <RegistryValue Root="HKCU" Key="Software/Microsoft/WixSingleSetup" Name="installed" Type="integer" Value="1" KeyPath="yes" />
      </Component>
    </DirectoryRef>
  </Fragment>
</Wix>
Alkyne answered 29/1, 2013 at 12:59 Comment(4)
Log by installing with the following command msiexec /i WixSingleSetupExample.msi /lvoicewarmupx log.txt and see if the log file log.txt gives any indication to why the component isn't getting installed.Designate
I did as you asked, but the output log file is 1545 lines long. The startup path is correct in the log file but i could not see any indication of errors. Any suggestions where to look? Or I could send the file link here if you wish.Alkyne
The accepted answer below solves the problem. But with your comment, I've learnt how to log, so thank you.Alkyne
For anyone trying to find an indication of errors in an msi log, search for value 3Overturn
A
19

I am adding the code that works as intended for future reference and an exact answer to the question:

<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
  <Product Id="guid_here" Name="WixSingleSetupExample" Language="1055"
           Version="1.0.0.0" Manufacturer="Can Yucel" UpgradeCode="guid_here">
    <Package InstallerVersion="200" Compressed="yes" InstallScope="perMachine" />

    <MajorUpgrade DowngradeErrorMessage="A newer version of [ProductName] is already installed." />
    <MediaTemplate />

    <Feature Id="ProductFeature" Title="WixSingleSetupExample" Level="1">
      <ComponentGroupRef Id="ProductComponents" />
      <ComponentRef Id="ProgramMenuDir"/>
    </Feature>
  </Product>

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

      <Directory Id="DesktopFolder" Name="Desktop" />

      <Directory Id="ProgramMenuFolder" Name="Programs">
        <Directory Id="ApplicationProgramsFolder" Name="WixSingleSetup">
          <Component Id="ProgramMenuDir" Guid="guid_here">
            <RemoveFolder Id="ProgramMenuDir" On="uninstall"/>
            <RegistryValue Root="HKCU" Key="Software\[Manufacturer]\WixSetup"
                           Type="integer" Value="1" Name="installed" KeyPath="yes" />
          </Component>
        </Directory>
      </Directory>


      <Directory Id="ProgramFilesFolder">
        <Directory Id="INSTALLFOLDER" Name="WixSingleSetupExample" />
      </Directory>
    </Directory>
  </Fragment>

  <Fragment>
    <ComponentGroup Id="ProductComponents" Directory="INSTALLFOLDER">
      <!-- TODO: Remove the comments around this Component element and the
           ComponentRef below in order to add resources to this installer. -->
      <Component Id="ProductTextFile">
        <File Source="blankText.txt" KeyPath="yes">
          <Shortcut Id="desktopShortcut" Advertise="yes" Directory="DesktopFolder"
                    Name="WixSingleSetup Help" WorkingDirectory="INSTALLFOLDER"
                    Icon="icon1.txt" IconIndex="0">
            <Icon Id="icon1.txt" SourceFile="blankText.txt" />
          </Shortcut>
          <Shortcut Id="startMenuShotcut" Directory="ApplicationProgramsFolder"
                    Name="WiXSingleSetup Help" WorkingDirectory="INSTALLFOLDER"
                    Icon="icon2.txt" IconIndex="0" Advertise="yes">
            <Icon Id="icon2.txt" SourceFile="blankText.txt"/>
          </Shortcut>
        </File>      
      </Component>
    </ComponentGroup>
  </Fragment>
</Wix>
Alkyne answered 30/1, 2013 at 11:27 Comment(2)
@nam To be fair I am not sure.Alkyne
Error 1 ICE21: Component: 'ProgramMenuDir' does not belong to any FeatureIodize
S
1

I've started using Wix recently and I've got stuck with the problem you describe for weeks.

I found another way to add start menu shortcuts without adding extra components (to remove menu folders) and without creating hot-keys on the target machine registry.

This can be done by moving the <RemoveFolder ... /> definition into <Component Id="ProductTextFile" ...> element. Hereafter the modified working script:

<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
  <Product Id="{GUID HERE}" Name="WixSingleSetupExample" Language="1055"
           Version="1.0.0.0" Manufacturer="Can Yucel" UpgradeCode="{GUID HERE}">
    <Package InstallerVersion="200" Compressed="yes" InstallScope="perMachine" />

    <MajorUpgrade DowngradeErrorMessage="A newer version of [ProductName] is already installed." />
    <MediaTemplate />

    <Icon Id="ICON1.ICO" SourceFile="icon1.ico" />
    <Icon Id="ICON2.ICO" SourceFile="icon2.ico" />

    <Feature Id="ProductFeature" Title="WixSingleSetupExample" Level="1">
      <ComponentRef Id="ProductTextFile" />
    </Feature>
  </Product>

  <Fragment>
    <Directory Id="TARGETDIR" Name="SourceDir">
      <Directory Id="DesktopFolder" Name="Desktop" />

      <Directory Id="ProgramMenuFolder" Name="Programs">
        <Directory Id="ApplicationProgramsFolder" Name="WixSingleSetup" />
      </Directory>

      <Directory Id="ProgramFilesFolder">
        <Directory Id="INSTALLFOLDER" Name="WixSingleSetupExample" />
      </Directory>
    </Directory>
  </Fragment>

  <Fragment>
      <Component Id="ProductTextFile" Directory="INSTALLFOLDER" Guid="{GUID HERE}">
        <File Source="blankText.txt" KeyPath="yes">
          <Shortcut Id="desktopShortcut" Advertise="yes" Directory="DesktopFolder"
                    Name="WixSingleSetup Help" WorkingDirectory="INSTALLFOLDER"
                    Icon="ICON1.ICO" IconIndex="0" />

          <Shortcut Id="startMenuShotcut" Directory="ApplicationProgramsFolder"
                    Name="WiXSingleSetup Help" WorkingDirectory="INSTALLFOLDER"
                    Icon="ICON2.ICO" IconIndex="0" Advertise="yes" />
        </File>

        <RemoveFolder Id="ProgramMenuDir" Directory="ApplicationProgramsFolder" On="uninstall"/>
      </Component>
  </Fragment>
</Wix>
Sorn answered 16/2, 2018 at 10:31 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.