WiX 3.8; Desktop shortcut depending on chosen feature - wix

I'm struggling on creating a desktop-shortcut depending on the chosen feature(s) within the WiX-Installer. If I run the installer, no shortcut is appearing. Is doesn't matter if only one feature is chosen or both. Are there any ideas out there?
<?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="XXX" Name="MyProduct" Language="1031" Codepage="1252" Version="4.4.0" Manufacturer="MyCompany" UpgradeCode="XXX">
<Package Description="MyProductDescription" Comments="someText" InstallerVersion="400" Compressed="yes" InstallScope="perMachine" Languages="1031"/>
<Media Id="1" Cabinet="application.cab" EmbedCab="yes" CompressionLevel="high"/>
<Directory Id="TARGETDIR" Name="SourceDir">
<Directory Id="ProgramFilesFolder" Name="PFiles">
<Directory Name="LfF" Id="INSTALLDIR">
<Directory Id="BIN" Name="bin"/>
<Component Id="App1.exe" Directory="BIN" Guid="XXX">
<File Id="App1.exe" KeyPath="yes" Source="$(var.src)\App1.exe" />
</Component>
<wix:Component Id="DesktopShortcutApp1" Directory="DesktopFolder" Guid="" xmlns:wix="http://schemas.microsoft.com/wix/2006/wi">
<wix:Shortcut Id="desktopShortcutApp1" Directory="DesktopFolder" Name="App1.exe" Target="[App1.exe]" WorkingDirectory="BIN" Icon="DesktopIconApp1.exe" IconIndex="0" />
<wix:RegistryValue Root="HKCU" Key="Software\[Manufacturer]\App1_Desktop_Shortcut" Name="installed" Type="integer" Value="1" />
</wix:Component>
<Component Id="App2.exe" Directory="BIN" Guid="XXX">
<File Id="App2.exe" KeyPath="yes" Source="$(var.src)\App2.exe" />
</Component>
<wix:Component Id="DesktopShortcutApp2" Directory="DesktopFolder" Guid="" xmlns:wix="http://schemas.microsoft.com/wix/2006/wi">
<wix:Shortcut Id="desktopShortcutApp2" Directory="DesktopFolder" Name="App2.exe" Target="[App2.exe]" WorkingDirectory="BIN" Icon="DesktopIconApp2.exe" IconIndex="0" />
<wix:RegistryValue Root="HKCU" Key="Software\[Manufacturer]\App2_Desktop_Shortcut" Name="installed" Type="integer" Value="1" />
</wix:Component>
</Directory>
</Directory>
</Directory>
<Directory Id="DesktopFolder"/>
<Directory Id="ProgramMenuFolder">
<Directory Id="ProgramMenuDir" Name="MyProductName">
<Component Id="StartMenuShortcuts" Guid="XXX">
<RemoveFolder Id="ProgramMenuDir" On="uninstall"/>
<RegistryValue Root="HKCU" Key="Software\[Manufacturer]\[ProductName]" Type="string" Value=""/>
</Component>
</Directory>
</Directory>
</Directory>
<Feature Id="App1" Level="1" Title="App1" TypicalDefault="advertise">
<ComponentRef Id="App1.exe" />
<ComponentRef Id="DesktopShortcutApp1" />
</Feature>
<Feature Id="App2" Level="1" Title="App2" TypicalDefault="advertise">
<ComponentRef Id="App2.exe" />
<ComponentRef Id="DesktopShortcutApp2"/>
</Feature>
<UI>
</UI>
<WixVariable Id="WixUIBannerBmp" Value="..\src\bannerapp.bmp"/>
<WixVariable Id="WixUIDialogBmp" Value="..\src\dialogapp.bmp"/>
<UIRef Id="WixUI_FeatureTree_NoLicense"/>
<Icon Id="DesktopIconApp1.exe" SourceFile="$(var.src)\App1.exe"/>
<Icon Id="DesktopIconApp2.exe" SourceFile=".$(var.src)\App2.exe"/>
</Product>
The script is a shortened version of the original one. Content of the Directory Id="BIN" is generated through heat.exe and modified with xslt.

After a lot of try and error I've found a solution.
make the shortcut element to a child of the component containig the file element
make the icon element to a child of the shortcut element
set the Level="32767" and TypicalDefault="install" in each feature (which means: Do not install that feature)
During the setup process choose the feature(s) you want to install and only for this/these the desktopshortcut will be created.
And here is the code:
<?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="XXX" Name="MyProduct" Language="1031" Codepage="1252" Version="4.4.0" Manufacturer="MyCompany" UpgradeCode="XXX">
<Package Description="MyProductDescription" Comments="someText" InstallerVersion="400" Compressed="yes" InstallScope="perMachine" Languages="1031"/>
<Media Id="1" Cabinet="application.cab" EmbedCab="yes" CompressionLevel="high"/>
<Directory Id="TARGETDIR" Name="SourceDir">
<Directory Id="ProgramFilesFolder" Name="PFiles">
<Directory Name="LfF" Id="INSTALLDIR">
<Directory Id="BIN" Name="bin"/>
<Component Id="App1.exe" Directory="BIN" Guid="XXX">
<File Id="App1.exe" KeyPath="yes" Source="$(var.src)\App1.exe" />
<Shortcut Id="desktopShortcutApp1" Directory="DesktopFolder" Name="App1.exe" WorkingDirectory="BIN" Advertise="yes">
<Icon Id="DesktopApp1.ico" SourceFile="$(var.src)/App1.ico" />
</Shortcut>
</Component>
<Component Id="App2.exe" Directory="BIN" Guid="XXX">
<File Id="App2.exe" KeyPath="yes" Source="$(var.src)\App2.exe" />
<Shortcut Id="desktopShortcutApp2" Directory="DesktopFolder" Name="App2.exe" WorkingDirectory="BIN" Advertise="yes">
<Icon Id="DesktopApp2.ico" SourceFile="$(var.src)/App2.ico" />
</Shortcut>
</Component>
</Directory>
</Directory>
</Directory>
<Directory Id="DesktopFolder"/>
<Directory Id="ProgramMenuFolder">
<Directory Id="ProgramMenuDir" Name="MyProductName">
<Component Id="StartMenuShortcuts" Guid="XXX">
<RemoveFolder Id="ProgramMenuDir" On="uninstall"/>
<RegistryValue Root="HKCU" Key="Software\[Manufacturer]\[ProductName]" Type="string" Value=""/>
</Component>
</Directory>
</Directory>
</Directory>
<Feature Id="App1" Level="32767" Title="App1" TypicalDefault="install">
<ComponentRef Id="App1.exe" />
</Feature>
<Feature Id="App2" Level="32767" Title="App2" TypicalDefault="install">
<ComponentRef Id="App2.exe" />
</Feature>
<UI>
</UI>
<WixVariable Id="WixUIBannerBmp" Value="$(var.src)/bannerapp.bmp"/>
<WixVariable Id="WixUIDialogBmp" Value="$(var.src)/dialogapp.bmp"/>
<UIRef Id="WixUI_FeatureTree_NoLicense"/>
</Product>
</Wix>

Related

WIX copying files harvested by heat, but does not create cab file

Fairly new to Wix. I have a working msi, but instead of a cab file next to the msi file, I am just getting a folder. I have spent several days trying to figure out why it is not putting the files in a cab file but I am completely at a loss.
The msi file performs exactly as I expect, but distributing the msi alongside a folder is less desirable than just the msi.
<?xml version="1.0"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
<Product Id="*" Name="[Name]" Language="1033" Manufacturer="[Manufacturer]" Version="2.0.30"
UpgradeCode="af66ae21-61e4-4926-954d-ee89acf95ab3">
<Package InstallerVersion="200"/>
<MajorUpgrade DowngradeErrorMessage="A newer version of [Name] is already installed." />
<MediaTemplate/>
<Feature Id="ProductFeature" Title="[Title]" Level="1">
<ComponentRef Id="ApplicationShortcut" />
<ComponentRef Id="ApplicationShortcutDesktop" />
<ComponentGroupRef Id="WebApp" />
<ComponentGroupRef Id="ControlApp" />
</Feature>
</Product>
<Fragment>
<Directory Id="TARGETDIR" Name="SourceDir">
<Directory Id="ProgramFiles64Folder">
<Directory Id="ManufacturerName" Name="[Name]">
<Directory Id="INSTALLLOCATION" Name="[Name]" />
</Directory>
</Directory>
<Directory Id="ProgramMenuFolder">
<Directory Id="ApplicationProgramsFolder" Name="[Name]"/>
<Directory Id="DesktopFolder" Name="Desktop"></Directory>
</Directory>
</Directory>
</Fragment>
<Fragment>
<DirectoryRef Id="ApplicationProgramsFolder">
<Component Id="ApplicationShortcut" Guid="844b584d-6d5f-4825-9541-c7caf74892fb">
<Shortcut Id="ApplicationStartMenuShortcut"
Name="[Name]"
Description="[Name]"
Target="[INSTALLLOCATION]MyApp.exe"
WorkingDirectory="INSTALLLOCATION" />
<RemoveFolder Id="RemoveApplicationProgramsFolder" Directory="ApplicationProgramsFolder" On="uninstall" />
<RegistryValue Root="HKCU" Key="Software\[Name]" Name="installed" Type="integer" Value="1" KeyPath="yes" />
</Component>
</DirectoryRef>
<DirectoryRef Id="DesktopFolder">
<Component Id="ApplicationShortcutDesktop" Guid="629d0ac6-8c63-4309-af33-975925584d1f">
<Shortcut Id="ApplicationDesktopShortcut"
Name="[Name]"
Description="[Name]"
Target="[INSTALLLOCATION]MyApp.exe"
WorkingDirectory="INSTALLLOCATION" />
<RemoveFolder Id="RemoveDesktopFolder" Directory="DesktopFolder" On="uninstall" />
<RegistryValue Root="HKCU" Key="Software\[Name]" Name="installed" Type="integer" Value="1" KeyPath="yes" />
</Component>
</DirectoryRef>
</Fragment>
</Wix>
Set the Package/#Compressed attribute to yes.

unable to install database using Wix

i have tried lot of times but in sql server mgmt studio db is not created
sa user is already created i have changed the user name but that does not work
Please refer the following files:
Product.wxs :`
<?xml version="1.0" encoding="UTF-8"?>
<!--For [DBStep:1] Sql Database Add Reffrence 1] xmlns:util 2]xmlns:sql-->
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi"
xmlns:util="http://schemas.microsoft.com/wix/UtilExtension"
xmlns:sql="http://schemas.microsoft.com/wix/SqlExtension">
<Product Id="680B2B06-567E-4BDB-9C37-63830049B51F"
Name="MyApp" Language="1033" Version="1.0.0.0" Manufacturer="My System Pvt Ltd"
UpgradeCode="A25F60C4-4037-4DA8-BA2F-6C482EF7D05A">
<Package Id="*" InstallerVersion="100" Compressed="yes" InstallScope="perMachine"
InstallPrivileges="elevated" ReadOnly="yes"/>
<MajorUpgrade DowngradeErrorMessage="A newer version of [ProductName] is already installed." />
<!--Add Cab1.cab File inside the Package-->
<Media Id="1" Cabinet="cab1.cab" EmbedCab="yes" />
<!--For [DBStep:2] Create User and add *.sql File-->
<util:User Id="SQLUser" Name="[SQLUSER]" Password="[SQLPASSWORD]" />
<!--Create Database User-->
<Binary Id="CreateTable" SourceFile="CreateTable.sql" />
<!--Add your script File-->
<Property Id="SQLUSER">sa</Property>
<Property Id="SQLPASSWORD">amit#123</Property>
<Property Id="SQLSERVER">LOCAL</Property>
<!--Here We Install Our Main App-->
<Directory Id="TARGETDIR" Name="SourceDir">
<Directory Id="ProgramFilesFolder">
<Directory Id="INSTALLFOLDER" Name="MY System Pvt Ltd"/>
</Directory>
<!-- Step 1: For the Program Menu -->
<Directory Id="ProgramMenuFolder">
<Directory Id="ApplicationProgramsFolder" Name="My System Pvt Ltd"/>
</Directory>
<!--Step 2:For Desktop Folder-->
<Directory Id="DesktopFolder"/>
<!--Step 3:For StartUp Folder-->
<Directory Id="StartupFolder"/>
</Directory>
<!--Step 4 :Add Main App exe-->
<DirectoryRef Id="INSTALLFOLDER">
<Component Id="myapplication.exe" Guid="854D88DA-D213-4805-B3DC-51F43837B124">
<File Source="$(var.WixDemoWPFAppVS2012.UI.TargetPath)" Name="MYApp.exe"
Id="MyAppEXE" KeyPath="yes"/>
</Component>
<!--[DBStep:3]Componant for Database-->
<Component Id="SqlComponent" Guid="1B3F5D84-D1A0-409D-9ADC-71C562344FEE" KeyPath="yes">
<sql:SqlDatabase Id="SqlDatabase" Database="Foobar" User="SQLUser" Instance="SQLEXPRESS"
Server="[SQLSERVER]" CreateOnInstall="yes" DropOnUninstall="yes"
ContinueOnError="yes" >
<sql:SqlScript Id="CreateTable" BinaryKey="CreateTable" ExecuteOnInstall="yes" />
</sql:SqlDatabase>
</Component>
</DirectoryRef>
<!-- Step 1.1: Add the shortcut to your installer package Program Menu or Start Menu-->
<DirectoryRef Id="ApplicationProgramsFolder">
<Component Id="ApplicationShortcut" Guid="8C4AC870-043C-4D36-A868-35354F2A0D9A">
<!--Add Shortcut of the Application in start Menu-->
<Shortcut Id="ApplicationStartMenuShortcut" Name="MyApp" Description="My Application Description"
Target="[INSTALLFOLDER]MyApp.exe" WorkingDirectory="INSTALLFOLDER">
<!--Add Icon to the ShortCut-->
<Icon Id="MYPMenuIcon" SourceFile=".\Desktop.ico" />
</Shortcut>
<Shortcut Id="UninstallShortcut"
Name="Uninstall My Software"
Description="Uninstalls My Software data"
Target="[System64Folder]msiexec.exe"
Arguments="/x [ProductCode]" />
<!--Remove the Folder At time of Uninstall-->
<RemoveFolder Id="ApplicationProgramsFolder" On="uninstall"/>
<RegistryValue Root="HKCU" Key='Software\[Manufacturer]\[ProductName]'
Name="installed" Type="integer" Value="1" KeyPath="yes"/>
</Component>
</DirectoryRef>
<!-- Step 2.1: Add the shortcut to your installer package For DeskTop-->
<DirectoryRef Id="DesktopFolder">
<Component Id="ApplicationDeskShortcutComp" Guid="29B9A804-9B2B-4E57-8803-E13C702FE100">
<Shortcut Id="ApplicationDeskShortcut" Name="MYAppDesk"
Description="My Application Description" Target="[INSTALLFOLDER]MyApp.exe"
WorkingDirectory="INSTALLFOLDER">
<Icon Id="MYDeskIcon" SourceFile=".\Desktop.ico" />
</Shortcut>
<RemoveFolder Id="DesktopFolder" On="uninstall"/>
<RegistryValue Root="HKCU" Key='Software\[Manufacturer]\[ProductName]'
Name="installed" Type="integer" Value="1" KeyPath="yes"/>
</Component>
</DirectoryRef>
<!--Step 3.1: add Shortcut to StartUp Folder to run application when you login-->
<DirectoryRef Id="StartupFolder">
<Component Id="ApplicationStartUpShortcutComp" Guid="C4340A05-0D11-4F54-9DD7-7A058A35DE43">
<Shortcut Id="ApplicationStartUpDeskShortcut" Name="MYAppDesk" Description="My Application Description"
Target="[INSTALLFOLDER]MyApp.exe" WorkingDirectory="INSTALLFOLDER">
<Icon Id="MyIconStartUp" SourceFile=".\Desktop.ico" />
</Shortcut>
<RemoveFolder Id="StartupFolder" On="uninstall"/>
<RegistryValue Root="HKCU" Key='Software\[Manufacturer]\[ProductName]'
Name="installed" Type="integer" Value="1" KeyPath="yes"/>
</Component>
</DirectoryRef>
<!--Add Component-->
<Feature Id="MainApplication" Title="Main Application" Level="1">
<ComponentRef Id="myapplication.exe" />
<!--Step 1.2:Add Start menu or program Shortcut-->
<ComponentRef Id="ApplicationShortcut" />
<!--step 2.2Add DeskTop Shortcut-->
<ComponentRef Id="ApplicationDeskShortcutComp" />
<!--step 3.2Add DeskTop Shortcut-->
<ComponentRef Id="ApplicationStartUpShortcutComp"/>
<!--[DBStep:4]Add Database Componant to the WXS file-->
<ComponentRef Id="SqlComponent" />
</Feature>
</Product>
</Wix>
`
CreateTable.sql :`
CREATE TABLE Test (Value1 CHAR(50), Value2 INTEGER)
CREATE INDEX TestIndex ON Test (Value1)
`

Windows installer XML doesn't copy assemblies into the installer

I have trouble with my installer file. The installer does build without any error but when I try to install it on another computer (which obvious doesn't have have the required assemblies) I am getting an error which says that the assembly couldn't be found. Do I miss something obvious?
<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
<Product Id="*" Name="Recap" Language="1033" Version="1.0.0.0" Manufacturer="Lavahayn Technology" UpgradeCode="6824BC1E-B8AD-4EE0-B3F7-B3E84859B9F9">
<Package InstallerVersion="200" Compressed="yes" InstallScope="perMachine" />
<MajorUpgrade DowngradeErrorMessage="A newer version of [ProductName] is already installed." />
<MediaTemplate />
<WixVariable Id="WixUILicenseRtf" Value="license.rtf" />
<Property Id="WIXUI_INSTALLDIR" Value="INSTALLFOLDER" />
<UIRef Id="WixUI_InstallDir" />
<Feature Id="ProductFeature" Title="Recap" Level="1">
<ComponentGroupRef Id="ProductComponents" />
<ComponentRef Id="ApplicationShortcuts"/>
<ComponentRef Id="UninstallerShortCut" />
</Feature>
</Product>
<Fragment>
<Directory Id="TARGETDIR" Name="SourceDir">
<Directory Id="ProgramFilesFolder">
<Directory Id="Company" Name="Lavahayn Technology" >
<Directory Id="INSTALLFOLDER" Name="Recap" >
<Component Id="UninstallerShortCut" Guid="3AE87174-A4B1-4887-8D23-5CC651B0CED8">
<Shortcut Id="UninstallProduct2"
Name="Uninstall"
Description="Removes Recap from your computer"
Target="[System64Folder]msiexec.exe"
Arguments="/x [ProductCode]"/>
<RemoveFolder Id="INSTALLFOLDER" On="uninstall"/>
</Component>
</Directory>
</Directory>
</Directory>
<Directory Id="ProgramMenuFolder">
<Directory Id="ProgramMenuSubfolder" Name="Lavahayn Technology">
<Component Id="ApplicationShortcuts" Guid="432BC349-14B9-4224-B226-A0C55B25498A">
<Shortcut Id="RecapShortcut" Name="Recap" Description="Lavahayn Technology Recap"
Target="[INSTALLDIR]LavahaynTechnology.Launcher.exe" WorkingDirectory="INSTALLDIR"/>
<RegistryValue Root="HKCU" Key="Software\LavahaynTechnology\Recap"
Name="installed" Type="integer" Value="1" KeyPath="yes"/>
<Shortcut Id="UninstallProduct"
Name="Uninstall"
Description="Removes Recap from your computer"
Target="[System64Folder]msiexec.exe"
Arguments="/x [ProductCode]"/>
<RemoveFolder Id="ApplicationProgramsFolder" On="uninstall"/>
</Component>
</Directory>
</Directory>
</Directory>
</Fragment>
<Fragment>
<ComponentGroup Id="ProductComponents" Directory="INSTALLFOLDER">
<Component Id="LavahaynTechnology.CsharpRecap.exe" Guid="1006A341-572D-45D7-9C0E-6F199C1CF0F5">
<File Id="LavahaynTechnology.CsharpRecap.exe" Source="$(var.CsharpRecap.TargetDir)CsharpRecap.exe" KeyPath="yes" Checksum="yes"/>
</Component>
<Component Id="LavahaynTechnology.Database.dll" Guid="872452AA-7075-450B-A28F-90252E9DBB6F">
<File Id="LavahaynTechnology.Database.dll" Source="$(var.LavahaynTechnology.Database.TargetDir)LavahaynTechnology.Database.dll" KeyPath="yes" Assembly=".net"/>
</Component>
<Component Id="LavahaynTechnology.Launcher.exe" Guid="C0FEB7B4-87BF-4120-A40C-A5849B84F6DA">
<File Id="LavahaynTechnology.Launcher.exe" Source="$(var.LavahaynTechnology.Launcher.TargetDir)LavahaynTechnology.Launcher.exe" KeyPath="yes" Checksum="yes"/>
</Component>
<Component Id="LavahaynTechnology.SDK.dll" Guid="55A6AEDA-162D-4BB7-9F7E-0BFBCB738402">
<File Id="LavahaynTechnology.SDK.dll" Source="$(var.LavahaynTechnology.SDK.TargetDir)LavahaynTechnology.SDK.dll" KeyPath="yes" Assembly=".net" />
</Component>
<Component Id="LavahaynTechnology.ObjectBase.dll" Guid="259F7357-D000-4B97-BA29-F11A176319CB">
<File Id="LavahaynTechnology.ObjectBase.dll" Source="$(var.LavahaynTechnology.ObjectBase.TargetDir)LavahaynTechnology.ObjectBase.dll" KeyPath="yes" Assembly=".net" />
</Component>
</ComponentGroup>
</Fragment>
</Wix>
Error Message

Wix will not touch AppData Folder During Install

So i've been working on this problem for days. My installer simply will not add anything into, or remove anything from, the roaming AppData folder in windows. I'm new to Wix and this is my first installer. The program is also shipped with a Bootstrapper which installs various prequisitaries and the .NET Framework. The code I have used is below.
<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
<Product Id="*" Name="USBackup" Language="1033" Version="!(bind.fileVersion.USBackup.exe)" Manufacturer="Ed Rose" UpgradeCode="795ea019-054a-4f34-8c9a-cb4e607897c0">
<Package Id="*" InstallerVersion="200" Compressed="yes" InstallScope="perMachine" />
<Icon Id="icon.ico" SourceFile="..\USBackup\resources\usb.ico"/>
<Property Id="ARPPRODUCTICON" Value="icon.ico" />
<MajorUpgrade DowngradeErrorMessage="A newer version of [ProductName] is already installed." />
<MediaTemplate EmbedCab="yes"/>
<UIRef Id="WixUI_Minimal" />
<UIRef Id="WixUI_ErrorProgressText" />
<PropertyRef Id="NETFRAMEWORK45"/>
<Condition Message='This setup requires the .NET Framework 4.5 installed.'>
<![CDATA[Installed OR NETFRAMEWORK45]]>
</Condition>
<Feature Id="ProductFeature" Title="Setup" Level="1">
<ComponentGroupRef Id="ProductComponents" />
<ComponentRef Id='ProgramMenuDir' />
<ComponentRef Id='AppDataDir'/>
<ComponentRef Id='DevicesDir'/>
</Feature>
</Product>
<Fragment>
<Directory Id="TARGETDIR" Name="SourceDir">
<Directory Id="ProgramFilesFolder">
<Directory Id="INSTALLFOLDER" Name="USBackup" />
</Directory>
<Directory Id="ProgramMenuFolder" Name="Programs">
<Directory Id="ProgramMenuDir" Name="USBackup">
<Component Id="ProgramMenuDir" Guid="{B01A59A5-ADA0-43FD-B14F-D479CD002E72}">
<RemoveFolder Id='ProgramMenuDir' On='uninstall' />
<RegistryValue Root='HKCU' Key='Software\[Manufacturer]\[ProductName]' Type='string' Value='' KeyPath='yes' />
</Component>
</Directory>
</Directory>
<Directory Id="CommonAppDataFolder" Name="CommonAppData">
<Directory Id="AppDataDir" Name="USBackup">
<Component Id="AppDataDir" Guid="{573BF504-1F52-40FE-A78A-96F43924379E}">
<RemoveFolder Id="AppDataDir" On="uninstall"/>
<RegistryValue Root='HKCU' Key='Software\[Manufacturer]\[ProductName]' Type='string' Value='' KeyPath='yes' />
</Component>
<Directory Id="DevicesDir" Name="Devices">
<Component Id="DevicesDir" Guid="{E145EA47-109F-42E7-ABAB-4E9A87FEC464}">
<RemoveFolder Id="DevicesDir" On="uninstall"/>
<RegistryValue Root='HKCU' Key='Software\[Manufacturer]\[ProductName]' Type='string' Value='' KeyPath='yes' />
</Component>
</Directory>
</Directory>
</Directory>
</Directory>
</Fragment>
<Fragment>
<ComponentGroup Id="ProductComponents" Directory="INSTALLFOLDER">
<Component Guid="{9D9BA12C-0859-46F0-B5E1-2A59BE96F83D}">
<File Source="$(var.USBackup.TargetPath)" KeyPath="yes">
<Shortcut Id="start" Directory="ProgramMenuDir" Name="USBackup" WorkingDirectory='INSTALLDIR' Icon="icon.ico" IconIndex="0" Advertise="yes" />
</File>
</Component>
<Component Guid="{6B473C52-6901-4FAC-A48B-20FC13A49C21}">
<File Source="..\USBackup\bin\Release\AutoUpdater.NET.dll" KeyPath="yes"/>
</Component>
<Component Guid="{6191F8CC-98A8-4424-A846-44DC1EB2A22C}">
<File Source="..\USBackup\bin\Release\USBackup.exe.config" KeyPath="yes"/>
</Component>
<Component Guid="{4E183A88-69DE-49D1-9142-13A2346443AF}">
<File Source="..\USBackup\bin\Release\USBackup.exe.manifest" KeyPath="yes"/>
</Component>
<!--Set to open on startup-->
<Component Id="RegistryKey" Guid="{8DBAB7DD-D9CD-4EC4-97F9-9A6131B40108}" Shared="yes">
<RegistryKey Root="HKCU" Key="Software\Microsoft\Windows\CurrentVersion\Run">
<RegistryValue Id="startupValue" Action="write" Name="USBackup" Value="[INSTALLFOLDER]USBackup.exe" Type="string"/>
</RegistryKey>
</Component>
</ComponentGroup>
</Fragment>
</Wix>
It builds with no errors or warnings. Why won't it touch the AppData Directory?
You have not given any reason for it to create it.
Include <CreateFolder/>, as such
<Component Id="AppDataDir" Guid="{573BF504-1F52-40FE-A78A-96F43924379E}">
<RegistryValue Root='HKCU' Key='Software\[Manufacturer]\[ProductName]' Type='string' Value='' KeyPath='yes' />
<CreateFolder />
</Component>

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