gpt4 book ai didi

windows - Wix 在卸载时删除多字符串注册表项中的单个值

转载 作者:可可西里 更新时间:2023-11-01 10:28:17 26 4
gpt4 key购买 nike

我的安装程序必须将一个值附加到现有的多字符串注册表项 (HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\LSA\Notification Packages):

<RegistryKey Id='RegistryEntry' Root='HKLM' Key='SYSTEM\CurrentControlSet\Control\Lsa' Action="createAndRemoveOnUninstall">
<RegistryValue Type='multiString' Name='Notification Packages' Value='p1' Action='append'/>
</RegistryKey>

问题是,在卸载时,它会删除整个 key :HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\LSA 即。 LSA 下的所有值都被删除,有什么方法可以删除我附加的值(仅 p1)并保留现有值?

最佳答案

WiX 的文档 <RegistryKey> 元素说(强调我的):

createAndRemoveOnUninstall

Creates the key, if absent, when the parent component is installed then remove the key with all its values and subkeys when the parent component is uninstalled. Note that this value is useful only if your program creates additional values or subkeys under this key and you want an uninstall to remove them. MSI already removes all values and subkeys that it creates, so this option just adds additional overhead to uninstall.

Additional evidence表明上述行为适用于多字符串值:安装程序引擎将在卸载时自动删除附加值,保留安装前存在的值。

因此,使用 create而不是 createAndRemoveOnUninstall应该做你想做的:

<RegistryKey Id="RegistryEntry" Root="HKLM"
Key="SYSTEM\CurrentControlSet\Control\Lsa"
Action="create">
<RegistryValue Type="multiString" Name="Notification Packages"
Value="p1" Action="append" />
</RegistryKey>

关于windows - Wix 在卸载时删除多字符串注册表项中的单个值,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7297930/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com