Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Install 32 bit files and 64 bit registry settings in WiX installer

Can I set up a 64-bit registry key to refer to a 32-bit program files path using WiX?

I'm writing a plugin for another piece of software. I want my plugin dll to go in C:\Program Files (x86)\MyPlugin\MyPlugin.dll not in C:\Program Files\MyPlugin\MyPlugin.dll because the dll is 32-bit, not 64-bit.

However, I need the registry key to go in HKLM/Software/Company/Product/Etc.... not in HKLM/Wow6432Node/Software/Company/Product/Etc.... because the process that actually reads the registry key is 64-bit. That 64-bit process reads the registry and launches a 32-bit process to sandbox the dll.

Is there any way to do this? I've tried using different components with different Win64 attribute values, and even putting them in separate component groups. However, I keep getting these build errors (not warnings):

ICE80: This 64BitComponent RegistryComponent uses 32BitDirectory INSTALLFOLDER
like image 344
Hans Avatar asked Dec 11 '14 17:12

Hans


3 Answers

A somewhat poor solution, but you could just a custom action to add registry entries, if you don't mind them sticking around after an uninstall.

If you write a custom action in C# you can just do something like this:

using (var hklm = RegistryKey.OpenBaseKey(RegistryHive.LocalMachine, RegistryView.Registry64))
{
    // do it
}
like image 104
user145400 Avatar answered Nov 06 '22 04:11

user145400


If you support 32-bit and 64-bit machines you need two separate MSI setups:

http://blogs.msdn.com/b/heaths/archive/2008/01/15/different-packages-are-required-for-different-processor-architectures.aspx

So your 32-bit install creates any COM entries for any 32-bit Clients and the 64-bit setup has 32-bit and 64-bit components that write to the registry.

http://msdn.microsoft.com/en-us/library/aa367451(v=vs.85).aspx

like image 3
PhilDW Avatar answered Nov 06 '22 03:11

PhilDW


A rather easy solution to only have one installer version for 32 and 64 bit is to export a .reg file with the keys you want to add (from regedit) and then run a custom action during install, ie:

<CustomAction Id='Add_Registry_Keys' Execute='deferred' Directory='DriverDir' Impersonate='no' ExeCommand='regedit.exe /s &quot;[DriverDir]default.reg' Return='ignore' />

like image 2
jo- Avatar answered Nov 06 '22 04:11

jo-