Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I fix WiX warning: Component 'X' has both per-user and per-machine data with an HKCU Registry KeyPath

Tags:

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.

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.

like image 292
Scott Langham Avatar asked Oct 25 '10 16:10

Scott Langham


2 Answers

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.

like image 172
heavyd Avatar answered Oct 11 '22 08:10

heavyd


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?

like image 30
Stabledog Avatar answered Oct 11 '22 09:10

Stabledog