Unresolved reference to symbol in WiX (LGHT0094) (No illegal characters?) - wix

I have searched here for answers but as every case seems to be unique and so far no answers helped me, I decided to post my own. For some reason I am getting the following error about the following code. I can't seem to find anything wrong with it. It has no illegal characters as far as I can see. I've tried with and without the " and it doesn't make a difference. The line specifically referenced in the error is the verb line.
Error:
C:\Users\kylec\Desktop\SampleFirst\SampleFirst.wxs(25) : error LGHT0094 :
Unresolved reference to symbol 'File:Viewer.exe' in section
'Product:{00000000-0000-0000-0000000000000000}'.
Code:
<?xml version='1.0' encoding='windows-1252'?>
<Wix xmlns='http://schemas.microsoft.com/wix/2006/wi'>
<Product Name='Viewer 1.0' Id='PUT-GUID-HERE' UpgradeCode='PUT-GUID-HERE'
Language='1033' Codepage='1252' Version='1.0.0' Manufacturer='Direct'>
<Package Id='*' Keywords='Installer' Description="Installer"
Comments='Installer is a registered trademark of Direct'
Manufacturer='Direct' InstallerVersion='100' Languages='1033'
Compressed='yes' SummaryCodepage='1252' />
<Media Id='1' Cabinet='Sample.cab' EmbedCab='yes' DiskPrompt="CD-ROM #1" />
<Property Id='DiskPrompt' Value="Installation [1]" />
<Directory Id='TARGETDIR' Name='SourceDir'>
<Directory Id='ProgramFilesFolder' Name='PFiles'>
<Directory Id='DataMotionDirect' Name='DMD'>
<Directory Id='INSTALLDIR' Name='Viewer'>
<Component Id='MainExecutable' Guid='*'>
<Shortcut Id="startmenuViewer" Directory="ProgramMenuDir"
Name="Viewer" WorkingDirectory='INSTALLDIR'
Icon="Viewer.exe" IconIndex="0" Advertise="yes" />
<Shortcut Id="desktopViewer" Directory="DesktopFolder"
Name="Viewer" WorkingDirectory='INSTALLDIR'
Icon="Viewer.exe" IconIndex="0" Advertise="yes" />
<File Id='EXE' Name='Viewer.exe' DiskId='1'
Source='Viewer.exe' KeyPath='yes'>
</File>
<ProgId Id="DMDCCDAV" Description="Viewer">
<Extension Id="xml" >
<Verb Id="open" Argument=""%1"" TargetFile="Viewer.exe" />
</Extension>
</ProgId>
</Component>
</Directory>
</Directory>
</Directory>
<Directory Id="ProgramMenuFolder" Name="Programs">
<Directory Id="ProgramMenuDir" Name="Viewer">
<Component Id="ProgramMenuDir" Guid="*">
<RemoveFolder Id='ProgramMenuDir' On='uninstall' />
<RegistryValue Root='HKCU' Key='Software\[Manufacturer]\[ProductName]'
Type='string' Value='' KeyPath='yes' />
</Component>
</Directory>
</Directory>
<Directory Id="DesktopFolder" Name="Desktop" />
</Directory>
<Feature Id='Complete' Level='1'>
<ComponentRef Id='MainExecutable' />
<ComponentRef Id='ProgramMenuDir' />
</Feature>
<Icon Id="Viewer.exe" SourceFile="Viewer.exe" />
</Product>
</Wix>

From the piece of source code you specified it is not clear what actual string wix references in fact. Would you kindly either highlight the string or post the entire file?
Ok then after you posted your entire file I see the problematic line. You must use file ID instead of file name there.

I don't have Wix set up to try this, but you can try to move the Shortcut element up to be nested under the Component element and not the File element. Then set the WorkingFolder attribute. Try something like this.
Like I said, I can't compile and test, but try to set the Target attribute to:
Target="[#Viewer.exe]"
<Shortcut Id="ApplicationStartMenuShortcut"
Name="My Application Name"
Description="My Application Description"
Target="[#Viewer.exe]"
WorkingDirectory="INSTALLDIR"/>

Related

What RegistryValue Root should be used in case of Single Package Authoring installation?

What RegistryValue Root should be used in case of Single Package Authoring installation?
This is a simple Single Package Authoring installation:
<?xml version='1.0' encoding='windows-1252'?>
<Wix xmlns='http://schemas.microsoft.com/wix/2006/wi'>
<Product Name='Foobar 1.0' Id='GUID' UpgradeCode='GUID'
Language='1033' Codepage='1252' Version='1.0.0' Manufacturer='Acme Ltd.'>
<Package Id='*' Keywords='Installer' Description="Acme's Foobar 1.0 Installer"
Comments='Foobar is a registered trademark of Acme Ltd.' Manufacturer='Acme Ltd.'
InstallerVersion='100' Languages='1033' Compressed='yes' SummaryCodepage='1252' />
<Property Id="ALLUSERS" Secure="yes" Value="2" />
<Property Id="MSIINSTALLPERUSER" Secure="yes" Value="1" />
<Property Id='ApplicationFolderName' Value="Acme" />
<Property Id='WixAppFolder' Value="WixPerUserFolder" />
<Media Id='1' Cabinet='Sample.cab' EmbedCab='yes' DiskPrompt="CD-ROM #1" />
<Property Id='DiskPrompt' Value="Acme's Foobar 1.0 Installation [1]" />
<Directory Id='TARGETDIR' Name='SourceDir'>
<Directory Id='ProgramFilesFolder' Name='PFiles'>
<Directory Id='Acme' Name='Acme'>
<Directory Id='INSTALLDIR' Name='Foobar 1.0'>
<Component Id='MainExecutable' Guid='GUID'>
<File Id='FoobarEXE' Name='FoobarAppl10.exe' DiskId='1' Source='FoobarAppl10.exe' KeyPath='yes'>
<Shortcut Id="startmenuFoobar10" Directory="ProgramMenuDir" Name="Foobar 1.0" WorkingDirectory='INSTALLDIR' Icon="Foobar10.exe" IconIndex="0" Advertise="yes" />
</File>
</Component>
</Directory>
</Directory>
</Directory>
<Directory Id="ProgramMenuFolder" Name="Programs">
<Directory Id="ProgramMenuDir" Name="Foobar 1.0">
<Component Id="ProgramMenuDir" Guid="GUID">
<RemoveFolder Id='ProgramMenuDir' On='uninstall' />
<RegistryValue Root='HKCU' Key='Software\[Manufacturer]\[ProductName]' Type='string' Value='' KeyPath='yes' />
</Component>
</Directory>
</Directory>
</Directory>
<Feature Id='Complete' Title='Foobar 1.0' Description='The complete package.'
Display='expand' Level='1' ConfigurableDirectory='INSTALLDIR'>
<Feature Id='MainProgram' Title='Program' Description='The main executable.' Level='1'>
<ComponentRef Id='MainExecutable' />
<ComponentRef Id='ProgramMenuDir' />
</Feature>
</Feature>
<Icon Id="Foobar10.exe" SourceFile="FoobarAppl10.exe" />
<UI Id="MyWixUI_Mondo">
<UIRef Id="WixUI_MySetup" />
</UI>
</Product>
</Wix>
During installation registry key 'Software[Manufacturer][ProductName]' will be created under HKCU root.
It is correct in case of per user installation.
But I am not sure that it is correct in case of per machine installation.
It is impossible to use HKLM instead of HKCU - wix will not compile such a file.
There is the error "ICE38: Component ProgramMenuDir installs to user profile. It's KeyPath registry key must fall under HKCU" during compilation.
Is it a problem?
Or should I use HKCU in case of per user and per machine installations if I use Single Package Authoring installation?
Windows Installer XML uses the root type "HKMU" to the MSI type "(none)" (-1). See: Registry Table
(none) - 0x001 -1 If this is a per-user installation, the registry
value is written under HKEY_CURRENT_USER. If this is a per-machine
installation, the registry value is written under HKEY_LOCAL_MACHINE.
Note that a per-machine installation is specified by setting the
ALLUSERS property to 1.

Setting the 'AllUsers' option on Wix installer does not work

I am using a WiX to install a service on test machine. But when I do that only the user who installed it on the machine is able to see in the 'Add/Remove Programs' control panel option. But I want to make it visible for every user on the machine.
I did some research and realized that I am not setting the AllUSERS property while creating the installer in the .wxs file.
So I updated my script with this line <Property Id="AllUSERS" Value="1"/> and created the installer. But still only the user who installed can see it in the Control Panel.
Here is my script to create the installer.
<?xml version='1.0' encoding='windows-1252'?>
<Wix xmlns='http://schemas.microsoft.com/wix/2006/wi'>
<Product Name='Importer Service' Id='PUT-GUID-HERE' UpgradeCode='PUT-GUID-HERE'
Language='1033' Codepage='1252' Version='$(var.version)' Manufacturer='Test'>
<Package Id='*' Keywords='Installer' Description="Imports data"
Manufacturer='Test' InstallerVersion='100' Languages='1033' Compressed='yes'
SummaryCodepage='1252' />
<Media Id='1' Cabinet='ImporterWebService.cab' EmbedCab='yes'
DiskPrompt="CD-ROM #1" />
<Property Id='DiskPrompt' Value="Importer Web Service 1.0 Installation [1]" />
<Property Id="WIXUI_INSTALLDIR" Value="INSTALLDIR" />
<Property Id="AllUSERS" Value="1"/>
<Directory Id='TARGETDIR' Name='SourceDir'>
<Directory Id='ProgramFilesFolder' Name='PFiles'>
<Directory Id='Test' Name='Test1'>
<Directory Id='INSTALLDIR' Name='Importer Service'>
<Component Id='MainExecutable' Guid='*'>
<File Id='ImporterWindowsServiceEXE'
Name='Importer.WindowsService.exe' DiskId='1'
Source='Importer.WindowsService.exe' KeyPath='yes'>
</File>
<ServiceInstall
Id="ImporterServiceInstaller"
Type="ownProcess"
Vital="yes"
Name="Importer Service"
DisplayName="Importer Service"
Description="Imports data."
Start="demand"
Account="LocalSystem"
ErrorControl="ignore"
Interactive="no">
</ServiceInstall>
<ServiceControl Id="StartService" Stop="both" Remove="uninstall"
Name="Importer Service" Wait="yes" />
</Component>
<Component Id='FileHelpersLibrary' Guid='*'>
<File Id='FileHelpersDLL' Name='FileHelpers.dll' DiskId='1'
Source='FileHelpers.dll' KeyPath='yes' />
</Component>
<Component Id='CodeSmithDataLibrary' Guid='*'>
<File Id='CodeSmithDataDLL' Name='CodeSmith.Data.dll' DiskId='1'
Source='CodeSmith.Data.dll' KeyPath='yes' />
</Component>
</Directory>
</Directory>
</Directory>
<Directory Id="ProgramMenuFolder" Name="Programs">
<Directory Id="ProgramMenuDir" Name="Importer Service">
<Component Id="ProgramMenuDir" Guid="*">
<RemoveFolder Id='ProgramMenuDir' On='uninstall' />
<RegistryValue Root='HKCU'
Key='Software\[Manufacturer]\[ProductName]'
Type='string' Value='' KeyPath='yes' />
</Component>
</Directory>
</Directory>
<Directory Id="DesktopFolder" Name="Desktop" />
</Directory>
<Feature Id='Complete' Title='Importer Service'
Description='The complete package'
Display='hidden' Level='1' ConfigurableDirectory='INSTALLDIR'>
<ComponentRef Id='MainExecutable' />
<ComponentRef Id='FileHelpersLibrary' />
<ComponentRef Id='CodeSmithDataLibrary' />
<ComponentRef Id='ProgramMenuDir' />
</Feature>
<UIRef Id="WixUI_InstallDir" />
<UIRef Id="WixUI_ErrorProgressText" />
</Product>
</Wix>
Could someone please look at the script and let me know what I am doing wrong.
Thanks.
Instead of setting ALLUSERS explicitly, try setting the InstallScope of the Package element to perMachine. According to the documentation, this fact:
Set this value to declare that the package is a per-machine
installation and requires elevated privileges to install. Sets the
ALLUSERS property to 1.
So, it should do the required job under the hood.

WIX : Merge Module Issue

When I try to use merge module feature in VS2010, I am getting an issue "Multiple Section entery"
Why i am getting this error?
I have done googling but I did not get any thread where i got my answer.
<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns='http://schemas.microsoft.com/wix/2006/wi'>
<Module Id="ModuleTest" Language="1033" Version="1.0.0.0">
<Package Id='94290AA7-50E3-414E-A1BD-FC3C2B0C47D8' Description='My first Merge Module'
Comments='This is my first attempt at creating a Windows Installer Merge Module'
Manufacturer='TravelPort Private Limited' InstallerVersion='200' />
<Directory Id='TARGETDIR' Name='SourceDir'>
<Directory Id='MyModuleDirectory' Name='.'>
<Component Id='MyModuleComponent' Guid='93F36B4B-B6E0-4000-8174-2660C0AE9D6A'>
<File Id='readme' Name='ReadMeModule' Source='ReadMergeModule.txt' DiskId='1' KeyPath='yes' Checksum='yes'></File>
</Component>
</Directory>
</Directory>
</Module>
</Wix>
product.wxs file
<Product Id="ec20ec5e-bb50-45d0-9190-156cf146c8f3" Name="WinDemoApp" Language="1033" Version="1.0.0.0" Manufacturer="WinDemoApp" UpgradeCode="979e03f4-3b50-43c1-9dde-dd675f726fde">
<Package InstallerVersion="200" Compressed="yes" />
<Media Id="1" Cabinet="media1.cab" EmbedCab="yes" />
<Directory Id="TARGETDIR" Name="SourceDir">
<Directory Id="ProgramFilesFolder">
<Directory Id="APPLICATIONROOTDIRECTORY" Name="WinDemoApp">
<!-- TODO: Remove the comments around this Component element and the ComponentRef below in order to add resources to this installer. -->
</Directory>
<Directory Id ="ProgramMenuFolder">
<Directory Id="ApplicationProgramsFolder" Name="WinDemoApp"></Directory>
</Directory>
<!--<Merge Id='MyModule' Language='1033' SourceFile='Module.msm' DiskId='1' />-->
</Directory>
</Directory>
<DirectoryRef Id="APPLICATIONROOTDIRECTORY">
<Component Id="MyApp.exe" Guid="36AA7C63-ED57-40C6-8B14-843B9355C265">
<File Id="MyApp.exe" Source="D:\WIXDemo\WinDemoApp\MyApp\bin\Debug\MyApp.exe" KeyPath="yes" Checksum="yes"></File>
</Component>
</DirectoryRef>
<DirectoryRef Id="ApplicationProgramsFolder">
<Component Id="ApplicationShortcut" Guid="EA549460-4D98-4B09-B621-D4F1AA12A617">
<Shortcut Id="ApplicationStartMenuShortcut" Name="WinDemoApp"
Description="My Win Installer sample"
Target="[APPLICATIONROOTDIRECTORY]MyApp.exe"
WorkingDirectory="APPLICATIONROOTDIRECTORY"/>
<RemoveFolder Id ="ApplicationProgramsFolder" On="uninstall"/>
<RegistryValue Root="HKCU" Key="Software\Microsoft\WinDemoApp" Name="installed" Type="integer" Value="1" KeyPath="yes"/>
</Component>
</DirectoryRef>
<!--<Icon Id="bug.ico" SourceFile="bug.ico"/>
<Property Id="ARPPRODUCTICON" Value="bug.ico" />-->
<Feature Id="MyApplication" Title="WinDemoApp" Level="1">
<!-- TODO: Remove the comments around this ComponentRef element and the Component above in order to add resources to this installer. -->
<ComponentRef Id="MyApp.exe"/>
<ComponentRef Id="ApplicationShortcut"/>
<!--<MergeRef Id="MyModule"/>-->
<!-- Note: The following ComponentGroupRef is required to pull in generated authoring from project references. -->
</Feature>
</Product>
The MyModuleDirectory directory element shouldn't have a name attribute. Also your Merge element should probably be nested underneath the ApplicationProgramsFolder directory. Where it's now it'll go to [ProgramFilesFolder].
Take a look at Industrial Strength Windows Installer XML.
Even if you don't want to use the tool, it's own installer is setup exactly the way you are setting up yours with merge modules consumed by a product.

WiX 3 driving me crazy - trying to create desktop shortcut

I have an app that is being installed with WiX 3 - most of the install works fine by now, but trying to get the desktop shortcut to work seems to cost me my mind...
I have my app being installed and I already have a shortcut on the Start Menu folder - works just fine. But how do I get the desktop shortcut up and running?
<Product Id="*" Name="....." UpgradeCode="MY-GUID">
<Package Id="*" InstallerVersion="200" Compressed="yes" />
<Media Id="1" Cabinet="foobar.cab" EmbedCab="yes" />
<Property Id="ALLUSERS">1</Property>
<Directory Id="TARGETDIR" Name="SourceDir">
<Directory Id="ProgramMenuFolder">
<Directory Id="ApplicationProgramsFolder" Name="FooBar"/>
</Directory>
<Directory Id="DesktopFolder" SourceName="Desktop"/>
<Directory Id="ProgramFilesFolder">
<Directory Id="FoobarDir" Name="FOOBAR">
<Directory Id="INSTALLLOCATION" Name="FooApp">
<Component Id="MainFiles" Guid=".....">
<File Id="FooMainApp" Source="FooMainApp.exe" />
</Component>
</Directory>
</Directory>
</Directory>
</Directory>
....
<!-- this shortcut here works just fine ... -->
<DirectoryRef Id="ApplicationProgramsFolder">
<Component Id="AppShortcut" Guid="...">
<Shortcut Id="ApplicationStartMenuShortcut"
Name="FooBarApp" Description="..."
Target="[INSTALLLOCATION]FooMainApp.exe"
WorkingDirectory="INSTALLLOCATION"/>
</Component>
</DirectoryRef>
<!-- but this shortcut here never seems to work .. ... -->
<DirectoryRef Id="DesktopFolder">
<Component Id="DesktopShortcut" Guid="....." >
<Shortcut Id="DesktopAppShortcut"
Advertise="no"
Name="FooBarApp" Description="...."
Target="[INSTALLLOCATION]FooMainApp.exe"
WorkingDirectory="INSTALLLOCATION"/>
</Component>
</DirectoryRef>
The errors I keep getting are:
ICE18: KeyPath for Component:
'DesktopShortcut' is Directory:
'DesktopFolder'. The
Directory/Component pair must be
listed in the CreateFolders table.
ICE38: Component DesktopShortcut
installs to user profile. It must use
a registry key under HKCU as its
KeyPath, not a file.
ICE43: Component
DesktopShortcut has non-advertised
shortcuts. It should use a registry
key under HKCU as its KeyPath, not a
file.
I do not understand what on earth WiX 3 / Windows Installer is trying to tell me here.... anyone??
Both components, AppShortcut and DesktopShortcut, are in fact part of the "main" feature - I don't see any issue there. I can't figure out what on earth could be wrong here....
Update: ok, so I added some registry key stuff to my desktop shortcut
<Component Id="DesktopShortcut" Guid="BF3587B4-F52E-411E-8814-CFCBF8201C0D">
<RegistryKey Root="HKCU" Key="Software\Foo Inc\FooBarApp\Installed"
Action="createAndRemoveOnUninstall">
<RegistryValue Name="DTSC" Value="1" Type="integer" KeyPath="yes"/>
</RegistryKey>
<Shortcut Id="DesktopShortcut" Directory="DesktopFolder"
Name="FooBar" WorkingDirectory="INSTALLLOCATION"
Icon="foobar.ico"
Target="[INSTALLOCATION]FooMainApp.exe"/>
</Component>
now the ICE messages are gone, but when I try to install the app, I get Error 1909 - the target folder doesn't exist, or you do not have permission to write to it (or something like that)
Update 2: the above sample code provided does work on Win XP, but it keeps failing on Win Server 2003 :-( Any further ideas??
Here's a working example from our live production code...
<Fragment>
<Component Id="DesktopShortcut" Directory="APPLICATIONFOLDER" Guid="*">
<RegistryValue Id="RegShortcutDesktop" Root="HKCU"
Key="SOFTWARE\ACME\settings" Name="DesktopSC" Value="1"
Type="integer" KeyPath="yes" />
<Shortcut Id="desktopSC" Target="[APPLICATIONFOLDER]MyApp.exe"
Directory="DesktopFolder" Name="My Application"
Icon="$(var.product).ico" IconIndex="0"
WorkingDirectory="APPLICATIONFOLDER" Advertise="no"/>
</Component>
</Fragment>
This is based on #saschabeaumont's answer, but hopefully with some extra helpful hints for us WiX beginners (is it a nightmare for everybody to learn???).
First, create a fragment that contains the shortcut details itself:
<Fragment>
<Component Id="DesktopShortcut" Directory="INSTALLFOLDER" Guid="*">
<RegistryValue Id="RegShortcutDesktop"
Root="HKCU"
Key="Software\Company\ApplicationName"
Name="DesktopSC"
Value="1"
Type="integer"
KeyPath="yes" />
<Shortcut Id="desktopSC"
Target="[INSTALLFOLDER]ApplicationName.exe"
WorkingDirectory="INSTALLFOLDER"
Icon="icon.ico"
Directory="DesktopFolder"
Name="ApplicationName"
Advertise="no"/>
</Component>
</Fragment>
Next, note that this fragment will need including in the Product element, like this:
<Feature Id="ProductFeature" Title="Your Application Title" Level="1">
...
<ComponentRef Id="DesktopShortcut" />
</Feature>
The ProductFeature will likely contain other fragments, such as files, and the program menu shortcut fragment.
Also, the DesktopFolder will need a reference in the TARGETDIR directory element (which will very likely contain other folders, such as ProgramMenuFolder as you require), like this:
<Directory Id="TARGETDIR" Name="SourceDir">
...
<Directory Id="DesktopFolder" Name="Desktop"/>
</Directory>
Each of these ICE messages is basically complaining about the same thing: a component installing a shortcut should have a registry entry as its keypath. To fix this, add something like this to the component:
<RegistryValue Root="HKCU" Key="Software\MyCompany\MyApplicationName"
Name="desktopShortcut" Type="integer" Value="1" KeyPath="yes"/>
The same goes for the component installing the start menu shortcut. Take a look at the related wix documentation sample about creating a shortcut.
My purpose is to create an internet shortcut link and put to desktop. Here is the code that works for me:
<?xml version="1.0" encoding="utf-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi" xmlns:util="http://schemas.microsoft.com/wix/UtilExtension">
<Product Id="09F1B63D-FB03-43FD-A326-FD49F93D00C8" Name="TestProduct" Language="1033" Version="0.0.0.1" Manufacturer="WixEdit" UpgradeCode="6B2F9AB4-73A6-45CB-9EC4-590D1AAA6779">
<Package Description="Test file in a Product" Comments="Simple test" InstallerVersion="200" Compressed="yes" />
<Media Id="1" Cabinet="simple.cab" EmbedCab="yes" />
<Directory Id="TARGETDIR" Name="SourceDir">
<Directory Id="ProgramFilesFolder" Name="PFiles">
<Directory Name="AAAA" Id="AAABBB">
<Component Id="AAAA">
<File Id="AAAA.EXE" Name="AAAA.exe" Source="U:\web\bin\x86\Release\AAAA.exe" />
</Component>
</Directory>
</Directory>
<Directory Id="DesktopFolder">
<Component Id="StartMenuShortcuts" Guid="E8EDD7BC-9762-4C3D-8341-FAEC983D318A">
<RemoveFolder Id="ProgramMenuDir" On="uninstall" />
<RegistryValue Root="HKCU" Key="Software\[Manufacturer]\[ProductName]" Type="string" Value="" />
<util:InternetShortcut Id="WebsiteShortcut" Name="AAAA Website" Target="http://www.AAAA.com" />
</Component>
</Directory>
</Directory>
<Feature Id="DefaultFeature" Title="Main Feature" Level="1">
<ComponentRef Id="StartMenuShortcuts" />
<ComponentRef Id="AAAA" />
</Feature>
<UI />
</Product>
</Wix>
NOTE: you need to add the following to your candle and light command lines: -ext WiXUtilExtension
Not sure if this was available back in 2010, but this is how I do it in WiX 3.7:
<Directory Id="TARGETDIR" Name="SourceDir">
<Directory Id="DesktopFolder" SourceName="Desktop" />
<Directory Id="MergeRedirectFolder">
<Component Id="MyExeComponent" Guid="{PUT-GUID-HERE}">
<File Id="MyExeFile" Source="$(var.ExeSourcePath)" KeyPath="yes">
<Shortcut
Id="DesktopShortcut"
Directory="DesktopFolder"
Name="$(var.ShortcutName)"
WorkingDirectory="MergeRedirectFolder" />
</File>
</Component>
</Directory>
</Directory>

Folder within Program Menu Folder for WiX 3

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