简体   繁体   English

WIX安装程序 - 将32位与64位区分开来

[英]WIX Installer - Differentiate 32bit from 64bits

I am new to wix and I have a quick fix to do ... 我是wix的新手,我可以快速修复...

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. 这是我的问题,我有一个安装程序,安装和注册一些DLL,但我们不想在64位架构上安装第二个DLL。

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 : 我也试过if语句,但它看起来在编译时被处理,所以它也没有用:

<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. 我的经验是%PROCESSOR_ARCHITECTURE不可靠。 I use VersionNT64 to consistently handle 32-bit vs 64-bit. 我使用VersionNT64来一致地处理32位和64位。

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: 在每个架构中处理每个架构,每个架构都有一个唯一的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>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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