简体   繁体   中英

WIX Installer - Differentiate 32bit from 64bits

I am new to wix and I have a quick fix to do ...

Here is my issue, I have an installer which install and register some dll but we do not want to install the second dll on 64bits architecture.

Here is the schema of our curent 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 symbols errors)

I also tried with a if statement but it looks to be processed at compilation time, so it did not worked 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 give me a clue on how to do this please ?

My experience is that %PROCESSOR_ARCHITECTURE is unreliable. I use VersionNT64 to consistently handle 32-bit vs 64-bit.

The following example installs a registry key selectively based on the 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>

Treat 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>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM