问题描述
我正在尝试维护一些 Wix 代码,但收到以下警告:
I'm trying to maintain some Wix code, and am getting the following warning:
warning LGHT1076 : ICE57: Component 'FILE_MY_ASSOCIATION' has both per-user and per-machine data with an HKCU Registry KeyPath.
来自以下代码:
<Component Id="FILE_MY_ASSOCIATION" Guid="E1DF42A5-BD00-4a80-9BE5-B66A3EF0576E" Win64="$(var.Variables_Win64)">
<RegistryKey Root="HKCU" Key="Software\MyComany\MyProduct">
<RegistryValue Value="" Type="string" KeyPath="yes" />
</RegistryKey>
<ProgId Icon="FILE_MY_FILETYPE_ICON" Id="MY_FILE_EXTENSION" Description="My Product File" >
<Extension Id="myext" Advertise="no" >
<Verb Id="Open" Argument=""%1"" TargetFile="MYUI_EXE_FILE"/>
</Extension>
</ProgId>
</Component>
我无法弄清楚出了什么问题,或者这是否是我真正需要担心的警告.
I'm having trouble working out what's wrong or if this is a warning I really need to worry about.
- 我需要担心并解决这个警告吗?在某些情况下,当前的代码是否会导致问题?
- 另外,我想知道为什么注册表项使用 HKCU 而不是 HKLM.如果我将其更改为 HKLM.警告消失了,但这会影响安装程序的行为吗?
谢谢.
推荐答案
警告表示您正在同一组件中写入用户特定数据和系统范围数据.您的注册表项正在写入 HKCU
,它将始终写入特定于用户的注册表部分.另一方面,ProgId
将注册表项写入 HKCR 可以写入 HKLM
或 HKCU
.如果它确实写入了系统范围的注册表空间 HKLM
,则您的单个组件正在写入用户特定的注册表配置单元和系统注册表配置单元,这违反了 ICE 警告你收到了.
The warning is saying that you are writing both user-specific data and system-wide data in the same component. Your registry entry is writing to HKCU
which will always write to a user-specific piece of the registry. ProgId
, on the other hand, writes registry entries to HKCR which could write to either HKLM
or HKCU
. If it does write to HKLM
that is a system-wide registry space, your single component is writing to both a user specific registry hive and a system registry hive which is against the rules laid out in the ICE warning you got.
这篇关于如何修复 WiX 警告:组件“X"具有每个用户和每个机器的数据以及 HKCU 注册表项路径的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!