Hans
Hans

Reputation: 2320

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

Upvotes: 7

Views: 3896

Answers (4)

Kflexior
Kflexior

Reputation: 337

You can suppress ICE errors also, not just warnings. This means you can use Win64 attributes in your x86 msi. The setting to ignore ICE validations is found in the Project Properties under the Tool Settings tab.

It might not be recommended, but if it works its still better than the alternative of a custom action.

Upvotes: 0

jo-
jo-

Reputation: 233

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' />

Upvotes: 2

user145400
user145400

Reputation: 1074

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
}

Upvotes: 4

PhilDW
PhilDW

Reputation: 20780

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

Upvotes: 3

Related Questions