WIX Installer - differentiates 32 bits from 64 bits

I am new to wix and I have a quick solution ...

Here is my problem, I have an installer that installs and registers some DLL, but we don’t want to install the second DLL on the 64-bit architecture.

Here is a diagram of our current installer file: ... ...

I tried to add a condition like this

<Directory Id="INSTALLDIR" .....> <Component Id="IDDLL" Guid="20E4601C-D93C-4A86-A0D9-31145D5443E6"> <File Id="common.dll" Name="common.DLL" .... SelfRegCost="1"/> <File Id="for32bits.dll" Name="for32bits.DLL" .... SelfRegCost="1"/> <Condition> %PROCESSOR_ARCHITECTURE="x86" </Condition> </Component> <Component Id="IDDLL" Guid="20E4601C-D93C-4A86-A0D9-31145D5443E6"> <File Id="common.dll" Name="common.DLL" .... SelfRegCost="1"/> <Condition> %PROCESSOR_ARCHITECTURE~="x86" </Condition> </Component> </Directory> 

This does not work (duplicate character errors)

I also tried with an if statement, but it looks processed at compile time, so it didn't work either:

 <Directory Id="INSTALLDIR" .....> <Component Id="IDDLL" Guid="20E4601C-D93C-4A86-A0D9-31145D5443E6"> <File Id="common.dll" Name="common.DLL" .... SelfRegCost="1"/> <? if %PROCESSOR_ARCHITECTURE = "x86" ?> <File Id="for32bits.dll" Name="for32bits.DLL" .... SelfRegCost="1"/> <?endif?> </Component> </Directory> 

Can someone let me know how to do this?

+4
source share
2 answers

View each architecture in its own component, each with a unique GUID:

 <Directory Id="INSTALLDIR" .....> <Component Id="IDDLL32" Guid="20E4601C-D93C-4A86-A0D9-31145D5443E6"> <File Id="for32bits.dll" Name="for32bits.DLL" .... SelfRegCost="1"/> <Condition> %PROCESSOR_ARCHITECTURE="x86" </Condition> </Component> <Component Id="IDDLL64" Guid="20E4601C-D93C-4A64-A0D9-31145D5443E6"> <File Id="common.dll" Name="common.DLL" .... SelfRegCost="1"/> <Condition> %PROCESSOR_ARCHITECTURE~="x86" </Condition> </Component> </Directory> 
+4
source

My experience is that% PROCESSOR_ARCHITECTURE is unreliable. I am using VersionNT64 to sequentially process 32-bit and 64-bit versions.

The following example selectively sets the registry key based on local architecture:

 <Component Id="RegistryAppPathsFoxit64" Guid="{FD5740AC-FE2C-4043-926B-DCE7422D77AE}"> <Condition>VersionNT64</Condition> <RegistryKey Root="HKLM" Key="SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\FoxitReader.exe" Action="createAndRemoveOnUninstall"> <RegistryValue Type="string" Value="C:\Program Files (x86)\Foxit Software\Foxit Reader\Foxit Reader.exe" /> </RegistryKey> </Component> <Component Id="RegistryAppPathsFoxit32" Guid="{7E78E125-CF56-46FC-BAF5-00B748052153}"> <Condition>NOT VersionNT64</Condition> <RegistryKey Root="HKLM" Key="SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\FoxitReader.exe" Action="createAndRemoveOnUninstall"> <RegistryValue Type="string" Value="C:\Program Files\Foxit Software\Foxit Reader\Foxit Reader.exe" /> </RegistryKey> </Component> 
+4
source

Source: https://habr.com/ru/post/1390869/


All Articles