How do I fix WiX warning: Component 'X' ha

2020-07-06 01:54发布

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.

From the following code:

<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="&quot;%1&quot;" 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.

  • Do I need to worry about and fix this warning? Could the code as it is currently cause problems in some circumstances?
  • Also, I'm wondering, why does the registry key use HKCU instead of HKLM. If I change it to HKLM. the warning goes away, but does this affect the behaviour of the installer?

Thanks.

标签: wix
2条回答
Summer. ? 凉城
2楼-- · 2020-07-06 02:29

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.

查看更多
够拽才男人
3楼-- · 2020-07-06 02:54

It sounds like the compiler is alerting you to behavior which may not be what you want: if you register a file association for the user only, other users will not see that association. That's an unusual behavior for an application. So, it depends on your requirements: do you want the app registered to handle all documents of that type for all users, or only the installing user?

查看更多
登录 后发表回答