title: Wix : adding my heat harvested files
body: <p>I have been struggling with Wix for the last couple of days, probably read 15 guides around the web so far trying to make it working on my real application, but no luck.</p>
  
  <p>I used a small and simple other project to practice and make sure I understand and do every thing right.</p>
  
  <p>Following this <a href="http://www.c-sharpcorner.com/UploadFile/cb88b2/getting-started-with-wix-windows-installer-xml-in-vs2012/" rel="nofollow">guide</a> I managed to got it to work, the next stage was trying to add the content of the directory to the installation since it holds many files that I dont want to add by hand.</p>
  
  <p>So following this <a href="http://chriseelmaa.com/harvesting-files-with-wix-heat/" rel="nofollow">guide</a> I used heat.exe to harvest the content of the folder, I got the heat to create the .wxs that I needed but next is trying to add its content to my Product.wxs file.</p>
  
  <p>Problem is that it says I should add this:</p>
  
  <pre><code>&lt;!-- Add ComponentGroupRef to existing Feature, or create new one --&gt;
  &lt;!-- Notice the IDs &amp; what we used in heat --&gt;
  &lt;Feature Id="ProductFeature" Title="Main product" Level="1"&gt;
  &lt;ComponentGroupRef Id="ConfigurationUtilityComponents"/&gt;
  &lt;/Feature&gt;
  
  &lt;Fragment&gt;
  &lt;Directory Id="INSTALLDIR" Name="SourceDir"&gt;
    &lt;Directory Id="ProgramFilesFolder"&gt;
      &lt;Directory Id="ConfigurationUtilityDir" Name="ConfigurationUtility" /&gt;
    &lt;/Directory&gt;
  &lt;/Directory&gt;
  &lt;/Fragment&gt;
  </code></pre>
  
  <p>to my Product.wxs file , but I cant seem to figure out how to do it.
  Can any one please help?</p>
  
  <p>Here is my Product.wxs file:</p>
  
  <pre><code>&lt;Product Id="8748CF04-E8D3-4A2B-B3F5-22E50B3A8E49"
         Name="MyApp" Language="1033" Version="1.0.0.0" Manufacturer="My System Pvt Ltd"
         UpgradeCode="8748CF04-E8D3-4A2B-B3F5-22E50B3A8E49"&gt;
  
  &lt;Package Id="*" InstallerVersion="200" Compressed="yes" InstallScope="perMachine"
            InstallPrivileges="elevated" ReadOnly="yes"/&gt;
  
  &lt;MajorUpgrade DowngradeErrorMessage="A newer version of [ProductName] is already installed." /&gt;
  &lt;!--Add Cab1.cab File inside the Package--&gt;
  &lt;Media Id="1" Cabinet="cab1.cab" EmbedCab="yes" /&gt;
  
  &lt;!--Here We Install Our Main App--&gt;
  &lt;Directory Id="TARGETDIR" Name="SourceDir"&gt;
    &lt;Directory Id="ProgramFilesFolder"&gt;
      &lt;Directory Id="INSTALLFOLDER" Name="MY System Pvt Ltd"/&gt;
    &lt;/Directory&gt;
  
    &lt;!-- Step 1: For the Program Menu --&gt;
    &lt;Directory Id="ProgramMenuFolder"&gt;
      &lt;Directory Id="ApplicationProgramsFolder" Name="My System Pvt Ltd"/&gt;
    &lt;/Directory&gt;
  
    &lt;!--Step 2:For Desktop Folder--&gt;
    &lt;Directory Id="DesktopFolder"/&gt;
  
    &lt;!--Step 3:For StartUp Folder--&gt;
    &lt;Directory Id="StartupFolder"/&gt;
  
  &lt;/Directory&gt;
  
  &lt;!--Step 4 :Add Main App exe--&gt;
  &lt;DirectoryRef Id="INSTALLFOLDER"&gt;
    &lt;Component Id="myapplication.exe" Guid="84C5B9E8-FD90-4EA8-A502-B08AC9B38D39"&gt;
      &lt;File Source="$(var.WpfApplication2.TargetPath)" Name="MYApp.exe"
            Id="MyAppEXE" KeyPath="yes"/&gt;
    &lt;/Component&gt;
  &lt;/DirectoryRef&gt;
  
  &lt;!-- Step 1.1: Add the shortcut to your installer package Program Menu or Start Menu--&gt;
  &lt;DirectoryRef Id="ApplicationProgramsFolder"&gt;
    &lt;Component Id="ApplicationShortcut" Guid="1A437020-D5C9-450C-9B3D-33957994780A"&gt;
      &lt;!--Add Shortcut of the Application in start Menu--&gt;
      &lt;Shortcut Id="ApplicationStartMenuShortcut" Name="MyApp" Description="My Application Description"
          Target="[INSTALLFOLDER]MyApp.exe" WorkingDirectory="INSTALLFOLDER"&gt;
        &lt;!--Add Icon to the ShortCut--&gt;
        &lt;Icon Id="MYPMenuIcon"  SourceFile=".\Desktop.ico" /&gt;
      &lt;/Shortcut&gt;
      &lt;!--Remove the Folder At time of Uninstall--&gt;
      &lt;RemoveFolder Id="ApplicationProgramsFolder" On="uninstall"/&gt;
      &lt;RegistryValue Root="HKCU"  Key='Software\[Manufacturer]\[ProductName]'
                     Name="installed" Type="integer" Value="1" KeyPath="yes"/&gt;
    &lt;/Component&gt;
  &lt;/DirectoryRef&gt;
  
  &lt;!-- Step 2.1: Add the shortcut to your installer package For DeskTop--&gt;
  &lt;DirectoryRef Id="DesktopFolder"&gt;
    &lt;Component Id="ApplicationDeskShortcutComp" Guid="40127963-856D-460D-9E1B-4C10EB65835B"&gt;
      &lt;Shortcut Id="ApplicationDeskShortcut" Name="MYAppDesk"
                Description="My Application Description" Target="[INSTALLFOLDER]MyApp.exe"
                WorkingDirectory="INSTALLFOLDER"&gt;
        &lt;Icon Id="MYDeskIcon"  SourceFile=".\Desktop.ico" /&gt;
      &lt;/Shortcut&gt;
      &lt;RemoveFolder Id="DesktopFolder" On="uninstall"/&gt;
      &lt;RegistryValue Root="HKCU"  Key='Software\[Manufacturer]\[ProductName]'
                     Name="installed" Type="integer" Value="1" KeyPath="yes"/&gt;
    &lt;/Component&gt;
  &lt;/DirectoryRef&gt;
  
  &lt;!--Step 3.1: add Shortcut to StartUp Folder to run application when you login--&gt;
  &lt;DirectoryRef Id="StartupFolder"&gt;
    &lt;Component Id="ApplicationStartUpShortcutComp" Guid="843B6A2E-AB61-40C7-BE49-FBCD7F81E35D"&gt;
      &lt;Shortcut Id="ApplicationStartUpDeskShortcut" Name="MYAppDesk" Description="My Application Description"
          Target="[INSTALLFOLDER]MyApp.exe" WorkingDirectory="INSTALLFOLDER"&gt;
        &lt;Icon Id="MyIconStartUp"  SourceFile=".\Desktop.ico" /&gt;
      &lt;/Shortcut&gt;
      &lt;RemoveFolder Id="StartupFolder" On="uninstall"/&gt;
      &lt;RegistryValue Root="HKCU"  Key='Software\[Manufacturer]\[ProductName]'  
                     Name="installed" Type="integer" Value="1" KeyPath="yes"/&gt;
    &lt;/Component&gt;
  &lt;/DirectoryRef&gt;
  
  &lt;!--Add Component--&gt;
  &lt;Feature Id="MainApplication" Title="Main Application" Level="1"&gt;
    &lt;ComponentRef Id="myapplication.exe" /&gt;
    &lt;!--Step 1.2:Add Start menu or program  Shortcut--&gt;
    &lt;ComponentRef Id="ApplicationShortcut" /&gt;
    &lt;!--step 2.2Add DeskTop Shortcut--&gt;
    &lt;ComponentRef Id="ApplicationDeskShortcutComp" /&gt;
    &lt;!--step 3.2Add DeskTop Shortcut--&gt;
    &lt;ComponentRef Id="ApplicationStartUpShortcutComp"/&gt;
    &lt;ComponentRef Id="dotNetClass.Output" /&gt;
    &lt;!--&lt;ComponentRef Id="AU" /&gt;--&gt;
  &lt;/Feature&gt; 
  &lt;/Product&gt;
  </code></pre>