如何在卸载时删除RegistryValue而不使用WIX删除父RegistryKey?

时间:2016-01-08 12:52:03

标签: wix multiple-instances registrykey

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

<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。不应删除其他实例的值。

2 个答案:

答案 0 :(得分:0)

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

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

答案 1 :(得分:0)

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