WIX安装程序 - 区分32位和64位

6

我是新手使用Wix,有一个快速修复的问题需要解决...

我的问题是,我有一个安装程序,安装并注册一些dll文件,但我们不希望在64位结构上安装第二个dll。

这是我们当前安装程序文件的架构: ... ...

我尝试添加一个条件,像这样:

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

这个不起作用(重复符号错误)

我也尝试使用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>

请问有人可以给我一个提示,告诉我如何做这个吗?

2个回答

5

将每个架构作为其自己的组件处理,每个组件都有唯一的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>

5

我的经验是%PROCESSOR_ARCHITECTURE不可靠。我使用VersionNT64来处理32位和64位。

以下示例根据本地架构有选择地安装注册表键:

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

你说PROCESSOR_ARCHITECTURE不可靠是什么意思?对于ARM、ARM64和Itanium,你会使用什么? - undefined

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接