title: WiX will not add HKLM registry setting during Windows 7 install
body: <p>I have written a WiX installer that works perfectly with Windows XP, but when installing to a Windows 7 box I am running into difficulty with registry entries. I need to add an HKLM entry as well as the registry entry for the program to show in the start menu. Here is the code I am using for both types of entry:</p>
  
  <pre><code>&lt;!-- Create the registry entries for the program --&gt;
  &lt;DirectoryRef Id="TARGETDIR"&gt;
    &lt;Component Id="RegistryEntriesInst" Guid="..."&gt;
      &lt;RegistryKey Root="HKLM"
                   Key="Software\$(var.Manufacturer)\$(var.ProductName)"
            Action="createAndRemoveOnUninstall"&gt;
        &lt;RegistryValue
            Type="string"
            Name="installed"
            Value="true"
            KeyPath="yes"/&gt;
      &lt;/RegistryKey&gt;
    &lt;/Component&gt;
    &lt;Component Id="RegistryEntriesVer" Guid="..."&gt;
      &lt;RegistryKey Root="HKLM"
                   Key="Software\$(var.Manufacturer)\$(var.ProductName)"
            Action="createAndRemoveOnUninstall"&gt;
        &lt;RegistryValue
            Type="string"
            Name="version"
            Value="$(var.ProductVersion)"
            KeyPath="yes"/&gt;
      &lt;/RegistryKey&gt;
    &lt;/Component&gt;
  &lt;/DirectoryRef&gt;
  
  &lt;!-- To add shortcuts to the start menu to run and uninstall the program --&gt;
  &lt;DirectoryRef Id="ApplicationProgramsFolder"&gt;
    &lt;Component Id="ApplicationShortcut" Guid="..."&gt;
      &lt;Shortcut Id="ApplicationStartMenuShortcut"
                Name="$(var.ProductName)"
                Description="..."
                Target="[SERVERLOCATION]$(var.Project.TargetFileName)"
                WorkingDirectory="SERVERLOCATION"/&gt;
      &lt;Shortcut Id="UninstallProduct"
                    Name="Uninstall $(var.ProductName)"
                    Description="..."
                    Target="[System64Folder]msiexec.exe"
                    Arguments="/x [ProductCode]"/&gt;
      &lt;RemoveFolder Id="SERVERLOCATION" On="uninstall"/&gt;
      &lt;RegistryValue
          Root="HKCU"
          Key="Software\$(var.Manufacturer)\$(var.ProductName)"
          Name="installed"
          Type="integer"
          Value="1"
          KeyPath="yes"/&gt;
      &lt;/Component&gt;
  &lt;/DirectoryRef&gt;
  </code></pre>
  
  <p>How can I fix this problem?</p>
  
  <p>On a side note, the registry permissions are the same on the Windows&nbsp;XP and Windows&nbsp;7 computers.</p>