在安装过程中,我必须安装一个外部驱动程序,该驱动程序取决于PC的操作系统.我知道我可以为每个操作系统构建多个安装程序包,但我必须在一个安装程序中完成.那可能吗?
我的第一个问题是找出PC上存在哪个操作系统.通过以下条件?
<Condition Message="Your Operating system is ... .">
VersionNT = 500
<?define PCPlatform = "Win2000" ?>
OR VersionNT = 501
<?define PCPlatform = "XP" ?>
OR VersionNT = 600
<?define PCPlatform = "Vista" ?>
OR VersionNT = 601
<?define PCPlatform = "Win7" ?>
</Condition>
Run Code Online (Sandbox Code Playgroud)
然后如何告诉安装程序要执行哪个文件?
<Component Id="Win32_W2K" Guid="...">
<File Id="vbsetup7" Source="..\driver\32Bit\W2K\vbsetup7.exe" Name="vbsetup7.exe" KeyPath="yes" DiskId="1"/>
</Component>
<Component Id="Win32_XP" Guid="...">
<File Id="vbsetup7" Source="..\driver\32Bit\XP\vbsetup7.exe" Name="vbsetup7.exe" KeyPath="yes" DiskId="1"/>
</Component>
<Component Id="Win32_Vista" Guid="...">
<File Id="vbsetup7" Source="..\driver\32Bit\Vista\vbsetup7.exe" Name="vbsetup7.exe" KeyPath="yes" DiskId="1"/>
</Component>
<Component Id="Win32_Win7" Guid="...">
<File Id="vbsetup7" Source="..\driver\32Bit\Win7\vbsetup7.exe" Name="vbsetup7.exe" KeyPath="yes" DiskId="1"/>
</Component>
<CustomAction Id="Virtual_Driver" FileKey="vbsetup7" Execute="deferred" ExeCommand="" Return="check" Impersonate="no"/>
Run Code Online (Sandbox Code Playgroud)
您必须添加Condition到组件中.在运行时,Condition必须仅对其中一个组件元素求值为true,即条件必须互斥.就像是:
<Component Id="Win32_W2K" Guid="...">
<Condition>VersionNT = 500</Condition>
<File Id="vbsetup7" Source="..\driver\32Bit\W2K\vbsetup7.exe" Name="vbsetup7.exe" KeyPath="yes" DiskId="1"/>
</Component>
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
1993 次 |
| 最近记录: |