views:

38

answers:

2

In case of installation on x64 I need to write two registry values:

1) <RegistryValue Root="HKLM" Key="SOFTWARE\Microsoft\Exchange" Name="Info" Type="string" Action="write" Value="8">

2) <RegistryValue Root="HKLM" Key="SOFTWARE\Wow6432Node\Microsoft\Exchange" Name="Info" Type="string" Action="write" Value="9"/>

I'm using <?if $(var.PlatformName) = x64 ?> to check if I'm on x64.

On win 7 64-bit it works fine, but on xp 64-bit it writes the value of the second key ("9") to the place of the first key (I guess it overwrites the first key). Any idea why? or how should I solve it?

+1  A: 

The correct way to do this in an .msi is to have these registry values in two separate components. Both would reference the key SOFTWARE\Microsoft\Exchange but one would be a 32-bit component and the other would be a 64-bit component. Note that a package which includes 64-bit components must have a 64-bit Template Summary value, and thus cannot be installed on a 32-bit machine.

Michael Urman
A: 

I think that first you need to understand that windows writes registry values on SOFTWARE\Wow6432Node due to registry reflection (this happens when an 32 bit installer is trying to write registry values to SOFTWARE\ or any key that supports registry reflection).

Registry reflection can be disabled for Registry element when you set the win64 attribute to true on it's parent Component.

But, as a best practice it’s recommended to create one MSI for x64 environments and one MSI for x86 environments.

If you want to know more about registry reflection you can check the next links.

Mario