更改由 WiX 设置的注册表项

更改由 WiX 设置的注册表项

问题描述:

我是 WiX 的新手.我需要更改以下注册表设置元素:

I'm new to WiX. I need to change the following registry-setting element:

    <Component Id="BrowserEmulation" Directory="ApplicationProgramsFolder" Guid="*">
      <RegistryValue Root="HKCU" Key="Software\Microsoft\Internet Explorer\Main\FeatureControl\FEATURE_BROWSER_EMULATION" Name="MY_REG_ENTRY" Value="11000" Type="integer" KeyPath="yes"/>
    </Component>

以便注册表项安装在 HKEY_LOCAL_MACHINE 而不是 HKEY_CURRENT_USER 下.我尝试更改 Root 值和 Key 值:

So that the registry entry gets installed under HKEY_LOCAL_MACHINE instead of HKEY_CURRENT_USER. I tried changing the Root value and the Key value:

    <Component Id="BrowserEmulation" Directory="ApplicationProgramsFolder" Guid="*">
      <RegistryValue Root="HKLM" Key="SOFTWARE\Microsoft\Internet Explorer\Main\FeatureControl\FEATURE_BROWSER_EMULATION" Name="MY_REG_ENTRY" Value="11000" Type="integer" KeyPath="yes"/>
    </Component>

我也尝试删除 KeyPath 组件.但是当我尝试构建 .msi 时,出现以下错误:

I also tried removing the KeyPath component. But when I try to build the .msi I get the following error:

错误 LGHT0204:ICE38:组件浏览器仿真安装给用户轮廓.它的 KeyPath 注册表项必须属于 HKCU

error LGHT0204: ICE38: Component Browser Emulation installs to user profile. It's KeyPath registry key must fall under HKCU

我查看了 描述组件 KeyPaths 的 WiX 文档 但无法弄清楚如何解决这个问题.

I looked at the WiX docs that describe Component KeyPaths but wasn't able to figure out how to get around this.

Directory:看起来您需要从组件中取出 Directory 属性.也许尝试这样的事情:

Directory: Looks like you need to take out the Directory attribute from your component. Maybe try something like this:

<Component Feature="MainApplication">
  <RegistryValue Root="HKLM" Key="SOFTWARE\Microsoft\Internet Explorer\Main\FeatureControl\FEATURE_BROWSER_EMULATION" Name="MY_REG_ENTRY" Value="11000" Type="integer" KeyPath="yes"/>
</Component>

位数:还要注意 HKLM 中 32 位和 64 位注册表配置单元的问题:HKLM\SOFTWARE\WOW6432Node 等...请参阅此答案以了解更多详情.我已经内联了最重要的部分:


Bitness: Also be aware of the issue with 32-bit and 64-bit registry hives in HKLM: HKLM\SOFTWARE\WOW6432Node etc... Please see this answer for more details. I have inlined the most important part:

注册:

  • 64 位:HKEY_LOCAL_MACHINE\SOFTWARE
  • 32 位:HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node

64 位:也许您需要将组件标记为 64 位组件?为了写在HKEY_LOCAL_MACHINE\SOFTWARE下?:

64-Bit: Maybe what you need is to mark your component as a 64-bit component? In order to write under HKEY_LOCAL_MACHINE\SOFTWARE?:

<Component Feature="MainApplication" Win64="yes">
   <RegistryValue Root="HKLM" Key="SOFTWARE\Microsoft\Internet Explorer\Main\FeatureControl\FEATURE_BROWSER_EMULATION" Name="MY_REG_ENTRY" Value="11000" Type="integer" KeyPath="yes"/>
</Component>