我正在使用WiX Toolset編寫Windows安裝程序包。我的應用程序集成Windows窗體WebBrowser控制—基本上Internet Explorer —我需要確保在我的安裝程序中的Internet Explorer的最低版本。我沒有發現WiX的一種簡單,內置的方法來檢查Internet Explorer版本(因爲有與.NET Framework),所以我下面的WiX的教程的instructions for checking a file's version number during installation隨着微軟的documentation of Internet Explorer version numbers(標題下,如何確定Windows的Internet Explorer版本,第三個要點)。爲什麼FileSearch元素的MinVersion屬性在我的WiX安裝程序中不起作用?
這裏是我的Product.wxs相關的代碼文件與解釋性意見包括:
<Property Id="IE10ORHIGHER">
<DirectorySearch Id="ProgFolder" Path="[ProgramFilesFolder]\Internet Explorer">
<!-- I tried the following line to ensure that my DirectorySearch Path
and FileSearch Name attributes were functioning correctly.
This line--without MinVersion set--results in the IE10ORHIGHER
property being defined during installation, but it is useless
because it merely detects that iexplore.exe exists rather than
ensuring a minimum version. -->
<!-- <FileSearch Name="iexplore.exe" /> -->
<!-- I need Internet Explorer 10 at minimum. -->
<!-- IE10 RTM for Windows 8 version number: 10.0.9200.16384 -->
<!-- IE10 RTM for Windows 7 version number: 10.0.9200.16521 -->
<!-- Use IE10 RTM for Windows 8 version string. Minimum in FileSearch
must be desired revision minus 1. See
https://msdn.microsoft.com/library/aa371853.aspx -->
<FileSearch Name="iexplore.exe" MinVersion="10.0.9200.16383" />
</DirectorySearch>
</Property>
<!-- Requires Internet Explorer 10 or higher. -->
<Condition Message="This application requires Internet Explorer 10 or higher. Please upgrade Internet Explorer, and then run this installer again.">
<![CDATA[Installed OR IE10ORHIGHER]]>
</Condition>
我運行Windows 8.1,我已經驗證了的iexplore.exe的在我的系統版本是11.0 .9600.17840。但是,當我使用完全日誌記錄(/ l * vx)編譯並運行我的安裝程序時,會顯示我的條件消息,並且未安裝該軟件。下面是我的MSIEXEC日誌文件的摘錄顯示了該文件的搜索,插入指出重要的線星:
Action 22:10:12: AppSearch. Searching for installed applications Action start 22:10:12: AppSearch. ★AppSearch: Property: IE10ORHIGHER, Signature: ProgFolder AppSearch: Property: NETFRAMEWORK45, Signature: NetFramework45 MSI (c) (BC:54) [22:10:12:849]: PROPERTY CHANGE: Adding NETFRAMEWORK45 property. Its value is '#379893'. Action ended 22:10:12: AppSearch. Return value 1. MSI (c) (BC:54) [22:10:12:849]: Doing action: LaunchConditions MSI (c) (BC:54) [22:10:12:849]: Note: 1: 2205 2: 3: ActionText Action 22:10:12: LaunchConditions. Evaluating launch conditions Action start 22:10:12: LaunchConditions. MSI (c) (BC:48) [22:10:12:856]: Font created. Charset: Req=0, Ret=0, Font: Req=MS Shell Dlg, Ret=MS Shell Dlg ★This application requires Internet Explorer 10 or higher. Please upgrade Internet Explorer, and then run this installer again. MSI (c) (BC:54) [22:10:14:276]: Note: 1: 2205 2: 3: Error MSI (c) (BC:54) [22:10:14:276]: Note: 1: 2228 2: 3: Error 4: SELECT `Message` FROM `Error` WHERE `Error` = 1709 ★MSI (c) (BC:54) [22:10:14:276]: Product: MyProductName -- This application requires Internet Explorer 10 or higher. You have installed. Please upgrade Internet Explorer, and then run this installer again. Action ended 22:10:14: LaunchConditions. Return value 3. Action ended 22:10:14: INSTALL. Return value 3. Property(C): UpgradeCode = {MY-GUID-REMOVED} Property(C): NETFRAMEWORK45 = #379893
爲了便於比較,下面是安裝日誌文件時,我用FileSearch元素的MINVERSION重新編譯屬性被省略。在這種情況下,Iexplore.exe文件肯定是發現,該屬性設置,程序安裝罰款(當然,這是省略版本檢查,我需要完成!)
Action start 21:40:48: AppSearch. AppSearch: Property: IE10ORHIGHER, Signature: ProgFolder ★MSI (c) (98:14) [21:40:48:761]: PROPERTY CHANGE: Adding IE10ORHIGHER property. Its value is 'C:\Program Files\Internet Explorer\iexplore.exe'. AppSearch: Property: NETFRAMEWORK45, Signature: NetFramework45 MSI (c) (98:14) [21:40:48:762]: PROPERTY CHANGE: Adding NETFRAMEWORK45 property. Its value is '#379893'. Action ended 21:40:48: AppSearch. Return value 1. MSI (c) (98:14) [21:40:48:762]: Doing action: LaunchConditions MSI (c) (98:14) [21:40:48:762]: Note: 1: 2205 2: 3: ActionText Action 21:40:48: LaunchConditions. Evaluating launch conditions Action start 21:40:48: LaunchConditions. Action ended 21:40:48: LaunchConditions. Return value 1. ★★★Numerous lines about the installation's progress skipped here★★★ Property(C): UpgradeCode = {MY-GUID-REMOVED} ★Property(C): IE10ORHIGHER = C:\Program Files\Internet Explorer\iexplore.exe Property(C): NETFRAMEWORK45 = #379893
爲什麼我的FileSearch無法識別iexplore.exe的版本11.0.9600.17840大於MinVersion屬性的值10.0.9200.16383?
更新有問題的原因和經修訂的課題 - 2015年8月25日
在回答Christopher Painter和Kiran Hegde答案,我開始在我的安裝項目的最小版本仍然會顯示錯誤的工作。在這樣做時,我發現了這個問題:我的安裝程序是dual-purpose package;默認情況下,它是按用戶運行的,因此指定Path="[ProgramFilesFolder]\Internet Explorer"
的DirectorySearch元素正在%LOCALAPPDATA%\Programs
之下搜索,而不是在%ProgramFiles%
之下搜索。我證實,這是嘗試以下解決方法的情況下/測試在命令提示符下,這兩者允許安裝成功完成:
解決方法/測試1 - 複製IE瀏覽器的地方安裝程序正在
robocopy "%ProgramFiles%\Internet Explorer" "%LOCALAPPDATA%\Programs\Internet Explorer" iexplore.exe
msiexec /package MyProductName.msi
rd /s /q "%LOCALAPPDATA%\Programs\Internet Explorer"
OR
解決方法/測試2 - 指定按機器安裝
msiexec /package MyProductName.msi ALLUSERS=1
找到問題的原因很好,但我仍然有問題。我的安裝程序需要根據用戶的選擇以每個用戶或每臺計算機的環境運行。由於MSI的ProgramFilesFolder
變量是特定於安裝上下文的,因此如何在每個用戶上下文中運行時測試IE版本%ProgramFiles%
下的版本?
我將您的代碼複製到一個新項目中,替換爲「E:\ Learning \ Test Projects \ Files \ abc.dll」中的「C:\ Windows \ System32 \ notepad.exe」。在我的機器上,Internet Explorer的版本是11.0.9600.17905。我使用MinVersion的以下值編譯並運行了此安裝程序三次:「11.0.9600.17905」,「11.0.9600.17904」和「11.0.9600.17900」。據我瞭解,第一個值應該導致消息出現(中止安裝),後兩者應該已經安裝而不顯示消息。但是,在所有三種情況下,都顯示了該消息,並且安裝被中止。 –
爲了回答你的問題,當我寫下「當我用FileSearch元素的MinVersion屬性省略重新編譯」時,我解釋說第二個日誌文件摘錄是我重新編譯「 「而不是」 「用於測試目的。 –
很奇怪。爲我工作沒有任何問題,但不是你。你使用的是什麼版本的Wix? –