在Windows 7安装期间,WiX不会添加HKLM注册表设置

Sco*_*ger 32 registry installer wix windows-7-x64

我编写了一个与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>
Run Code Online (Sandbox Code Playgroud)

我该如何解决这个问题?

另外,Windows XP和Windows 7计算机上的注册表权限是相同的.

Sco*_*ger 33

我已经弄清楚为什么会这样.

在x86平台上编译WiX安装程序后,Windows 7将其作为具有32位注册表项的32位安装程序.Windows 7 64位通过执行我所看到的操作来处理32位注册表项.

该计划仍在注册; 它只是不在注册表的64位部分.在x64平台下进行编译,同时进行必要的更改以使其适用于64位系统(ProgramFileFolder成为ProgramFiles64Folder等),并将它放在正确的位置.

  • 也许值得注意的是你在HKLM\Software\Wow6432Node\[var.Manufacturer]\[var.ProductName]下找到了这个条目 (5认同)

Jac*_*ley 19

谢谢你基本上为我解决了这个!

我只是想补充一点,你不一定需要将所有内容都更改为x64才能使其工作,只有相关组件需要标记为x64.

<Component Id="MyShellExtension64.dll" Guid="..." Win64="yes">
  <Condition>VersionNT64</Condition>
  <File
    Name="MyShellExtension64.dll"
    Source="MyShellExtension64.dll"
    KeyPath="yes"/>
  <RegistryValue
    Root="HKLM" Key="SOFTWARE\Microsoft\Windows\CurrentVersion\Shell Extensions\Approved"
    Name="{GUID}" Value="My Shell Extension" Type="string"/>
</Component>
Run Code Online (Sandbox Code Playgroud)

注意Win64 ="yes",这就是写入注册表的64位区域所需的全部内容.VersionNT64条件存在,因此该组件仅安装在x64系统上.

在我的情况下,这给出了ICE80警告,因为我想在32位ProgramFilesFolder中安装64位组件.我很高兴忽略这些因为因为我的主应用程序不是x64,只有shell扩展名,而且我不想将shell扩展名放在它自己的特殊文件夹中.


Mat*_*sky 5

Windows 7处理某些注册表项的方式存在一些差异.从Windows 7开始删除了注册表反射.我不确定这是否会影响您在此处看到的内容,但请查看此链接以获取更多信息.

此外,如果您使用的是64位版本的Windows 7,则可以通过参考MSDN 64位Windows编程指南深入了解某些细节.

此外,如果您需要根据Windows风格(XP,Vista,7等)将不同的注册表项安装到不同的位置,那么此Stack Overflow问题也可以为您提供答案.