2

This works fine:

<DirectoryRef Id="INSTALLDIR">
  <Component Id="RegistryValues" Guid="...">

    <RegistryKey Root="HKLM" Key="Software\company\Server" >
      <RegistryValue Type="string" Name="InstallPath" Value="[INSTALLDIR]" KeyPath="yes"/>
    </RegistryKey>

    <RemoveRegistryValue Root="HKCU" Key="SOFTWARE\company\Server" Name="version"/>

  </Component>
</DirectoryRef>

But this:

<DirectoryRef Id="INSTALLDIR">
  <Component Id="RegistryValues" Guid="...">

    <RegistryKey Root="HKLM" Key="Software\company\Server" >
      <RegistryValue Type="string" Name="InstallPath" Value="[INSTALLDIR]" KeyPath="yes"/>
    </RegistryKey>

    <RemoveRegistryKey Action="removeOnUninstall"
                       Root="HKCU" Key="SOFTWARE\company\Server\version"/>

  </Component>
</DirectoryRef>

leads to error:

error LGHT0204: ICE57: Component 'RegistryValues' has both per-user and per-machine data with a per-machine KeyPath.

Why the first case doesn't throw the same error?
version 3.8.1128.0

Yan Sklyarenko
  • 31,557
  • 24
  • 104
  • 139
Taras Kozubski
  • 1,854
  • 1
  • 20
  • 33

0 Answers0