WiX will not add HKLM registry setting during Windows 7 install

最后都变了- 提交于 2019-11-30 02:49:51
Scott Boettger

I have figured out why this is happening.

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.

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.

Thanks for basically solving this one for me!

I just wanted to add that you don't necessarily need to change everything to be x64 for this to work, only the component in question needs to be marked as 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>

Note the Win64="yes", that is all that is required to write to the 64-bit area of the registry. The VersionNT64 condition is there so that this component will only be installed on an x64 system.

In my case this gives ICE80 warnings because I want to install a 64-bit component in the 32-bit ProgramFilesFolder. I'm happy to ignore these because because my main application isn't x64, only the shell extension is, and I don't want to put the shell extension in it's own special folder.

Mat Nadrofsky

There are some differences to how Windows 7 handles certain registry keys. Registry reflection was removed starting with Windows 7. I am not sure if this plays into what you're seeing here, but check out this link for more on that.

Also, if you're working with a 64-bit version of Windows 7 you might be able to dig down into some specifics by referring to the MSDN 64-bit Windows Programming Guide.

Furthermore, if you need to have different registry keys installed into different locations based on the Windows flavour (XP, Vista, 7, etc.) then this Stack Overflow question also has an answer for you.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!