WiX 不会在 Windows 7 安装期间添加 HKLM 注册表设置 [英] WiX will not add HKLM registry setting during Windows 7 install
问题描述
我编写了一个与 Windows XP 完美配合的 WiX 安装程序,但是在安装到 Windows 7 机器时,我遇到了注册表项的困难.我需要添加一个 HKLM 条目以及该程序的注册表条目以显示在开始菜单中.这是我用于这两种条目的代码:
I have written a WiX installer that works perfectly with Windows XP, but when installing to a Windows 7 box I am running into difficulty with registry entries. I need to add an HKLM entry as well as the registry entry for the program to show in the start menu. Here is the code I am using for both types of entry:
<!-- Create the registry entries for the program -->
<DirectoryRef Id="TARGETDIR">
<Component Id="RegistryEntriesInst" Guid="...">
<RegistryKey Root="HKLM"
Key="Software$(var.Manufacturer)$(var.ProductName)"
Action="createAndRemoveOnUninstall">
<RegistryValue
Type="string"
Name="installed"
Value="true"
KeyPath="yes"/>
</RegistryKey>
</Component>
<Component Id="RegistryEntriesVer" Guid="...">
<RegistryKey Root="HKLM"
Key="Software$(var.Manufacturer)$(var.ProductName)"
Action="createAndRemoveOnUninstall">
<RegistryValue
Type="string"
Name="version"
Value="$(var.ProductVersion)"
KeyPath="yes"/>
</RegistryKey>
</Component>
</DirectoryRef>
<!-- To add shortcuts to the start menu to run and uninstall the program -->
<DirectoryRef Id="ApplicationProgramsFolder">
<Component Id="ApplicationShortcut" Guid="...">
<Shortcut Id="ApplicationStartMenuShortcut"
Name="$(var.ProductName)"
Description="..."
Target="[SERVERLOCATION]$(var.Project.TargetFileName)"
WorkingDirectory="SERVERLOCATION"/>
<Shortcut Id="UninstallProduct"
Name="Uninstall $(var.ProductName)"
Description="..."
Target="[System64Folder]msiexec.exe"
Arguments="/x [ProductCode]"/>
<RemoveFolder Id="SERVERLOCATION" On="uninstall"/>
<RegistryValue
Root="HKCU"
Key="Software$(var.Manufacturer)$(var.ProductName)"
Name="installed"
Type="integer"
Value="1"
KeyPath="yes"/>
</Component>
</DirectoryRef>
我该如何解决这个问题?
How can I fix this problem?
附带说明,Windows XP 和 Windows 7 计算机上的注册表权限是相同的.
On a side note, the registry permissions are the same on the Windows XP and Windows 7 computers.
推荐答案
我已经弄清楚为什么会这样了.
I have figured out why this is happening.
在 x86 平台上编译 WiX 安装程序后,Windows 7 将其选为具有 32 位注册表项的 32 位安装程序.Windows 7 64 位通过执行我所看到的操作来处理 32 位注册表项.
With the WiX installer being compiled on a x86 platform, Windows 7 picked it up as the 32-bit installer with 32-bit registry keys. Windows 7 64-bit handles 32-bit registry entries by doing just what I saw happening.
程序仍然被注册;它只是不在注册表的 64 位部分中.在 x64 平台下编译它,同时进行必要的更改以使其适用于 64 位系统(ProgramFileFolder 变为 ProgramFiles64Folder 等),它将把东西放在正确的位置.
The program was still registered; it was just not in the 64-bit portion of the registry. Compile it under a x64 platform while making the necessary changes to make it for a 64-bit system (ProgramFileFolder become ProgramFiles64Folder, etc.), and it will put things in the right place.
这篇关于WiX 不会在 Windows 7 安装期间添加 HKLM 注册表设置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!