如何在不使用 WIX 删除父 RegistryKey 的情况下在卸载时删除 RegistryValue?

How can I remove a RegistryValue on uninstall without removing the parent RegistryKey with WIX?

如果我使用以下代码,那么卸载时不会删除任何内容。

<DirectoryRef Id="INSTALLDIR">
  <Component Guid="xyz" Id="instance_path" MultiInstance="yes">
    <RegistryKey ForceCreateOnInstall="yes" Id="instance_path_reg" Key="Software\i-net software GmbH\i-net Test\Instances" Root="HKLM">
      <RegistryValue Name="[INSTANCE_NUMBER]" Type="string" Value="[INSTALLDIR]"/>
    </RegistryKey>
  </Component>
</DirectoryRef>

如果我将 ForceCreateOnInstall="yes" 替换为 ForceDeleteOnUninstall="yes",那么在卸载时所有内容都会被删除。

但我只想删除此实例的 RegistryValue。不应删除其他实例的值。

您可以尝试使用 RemoveRegistryValue 并保留您当前的条目。有点乱,但应该能完成工作。

http://wixtoolset.org/documentation/manual/v3/xsd/wix/removeregistryvalue.html

问题是 属性 INSTANCE_NUMBER 没有在卸载时设置。卸载程序已尝试删除不存在的密钥。