在安裝過程中,我必須安裝一個取決於PC操作系統的外部驅動程序。我知道我可以爲每個操作系統構建幾個安裝程序包,但我必須在一個安裝程序中完成。那可能嗎?WiX - 安裝依賴於操作系統的驅動程序
我的第一個問題是找出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>
然後如何告訴安裝程序要執行哪個文件?
<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"/>
第一個問題就解決了。謝謝 – Sabine 2011-05-08 14:35:41