我编写了一个与 Windows XP 完美配合的 WiX 安装程序,但是在安装到 Windows 7 机器时,我遇到了注册表项的困难。我需要添加一个 HKLM 条目以及该程序的注册表条目以显示在开始菜单中。这是我用于两种条目的代码:
<!-- 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>
我该如何解决这个问题?
附带说明一下,Windows XP 和 Windows 7 计算机上的注册表权限是相同的。