使用Advanced Installer打包工具如何設置是否安裝預安裝程序包


  要保證我們的程序能在目標機器上正常運行,便需要保證目標機器上提供了程序運行的必要組件。

  而在使用Advanced Installer打包工具制作程序安裝包時,我們可以通過配置“需求-運行環境-程序包-預安裝”來達到這一目的。

  如上圖所示,我的程序需要.NET和VC++組件才能正常運行。那么我可以右鍵點擊“預安裝”,選擇“新建包的運行環境”,將這些組件添加到“預安裝”下面。於是我的安裝包在安裝時,優先安裝“預安裝”下面的組件包。

  此時,便衍生出了一個問題。若目標機器上安裝了這些組件,則會進行重復安裝,甚至組件安裝失敗等情況。如何檢測目標機器是否安裝過組件呢?下面以.NET Framework 4.6.1和Microsoft Visual C++ 2015 Redistributable (x86) - 14.0.24215為例來說明如何配置檢測機制。

  1.檢測機器上是否安裝.NET Framework 4.6.1。

    上述條件表示,若沒有找到符合條件的項,則安裝.NET Framework 4.6.1。接下來說說如何設置條件。

  首先,選擇“安裝基本的必須組件”(會自動插入一條無效默認條件),點擊“編輯”按鈕,會彈出如下圖所示的界面。

  “標准”選擇“有指定內容的注冊表值”,注冊表值選擇“HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\NET Framework Setup\NDP\v4\Full\Release”。如下圖所示:

  在“內容”欄中,“值”欄位填“394270”,“比較”欄位選擇“大於”。這個條件的意思是:檢測目標機器中是否安裝了.NET Framework 4.6.1及以上版本。為什么值是394270,因為394271代表.NET Framework 4.6.1。上圖中528040(十六進制0x00080ea8)表示目標機器安裝的是.NET Framework 4.8版本。下面提供一張官方.NET Framework的Release DWORD值說明表。

 

  2.檢測機器上是否安裝Microsoft Visual C++ 2015 Redistributable (x86) - 14.0.24215

  重復的動作不再多做贅述。下面直接說說如何配置Microsoft Visual C++ 2015 Redistributable的檢測條件。

  點擊“編輯”,打開如下界面:

  點擊“注冊表值”中的“...”選擇按鈕,打開注冊表界面,選擇Microsoft Visual C++ 2015 Redistributable (x86) - 14.0.24215代表的項,如下圖所示:

  在“內容”欄位中,“值”填入文件夾名稱(與“數據”欄位的值是相同的),“比較”選擇“包含”,點擊“確定”完成條件的添加。值得注意的是,Microsoft Visual C++ 2015 Redistributable與Microsoft Visual C++ 2017 Redistributable好像不能共存,因此在添加條件時,需要同時檢測Microsoft Visual C++ 2015 Redistributable與Microsoft Visual C++ 2017 Redistributable,如果有了更高的版本,則不需要安裝Microsoft Visual C++ 2015 Redistributable了。

  順便提供一下各VC++組件信息:

Visual C++ 2005
Microsoft Visual C++ 2005 Redistributable (x64)
Registry Key: HKLM\SOFTWARE\Classes\Installer\Products\1af2a8da7e60d0b429d7e6453b3d0182
Configuration: x64
Version: 6.0.2900.2180
Direct Download URL: https://download.microsoft.com/download/8/B/4/8B42259F-5D70-43F4-AC2E-4B208FD8D66A/vcredist_x64.EXE

Microsoft Visual C++ 2005 Redistributable (x86)
Registry Key: HKLM\SOFTWARE\Classes\Installer\Products\c1c4f01781cc94c4c8fb1542c0981a2a
Configuration: x86
Version: 6.0.2900.2180
Direct Download URL: https://download.microsoft.com/download/8/B/4/8B42259F-5D70-43F4-AC2E-4B208FD8D66A/vcredist_x86.EXE

Visual C++ 2008
Microsoft Visual C++ 2008 Redistributable (x64)
Registry Key: HKLM\SOFTWARE\Classes\Installer\Products\67D6ECF5CD5FBA732B8B22BAC8DE1B4D
Configuration: x64
Version: 9.0.30729.5677
Direct Download URL: https://download.microsoft.com/download/5/D/8/5D8C65CB-C849-4025-8E95-C3966CAFD8AE/vcredist_x64.exe

Microsoft Visual C++ 2008 Redistributable (x86)
Registry Key: HKLM\SOFTWARE\Classes\Installer\Products\6E815EB96CCE9A53884E7857C57002F0
Configuration: x86
Version: 9.0.30729.5677
Direct Download URL: https://download.microsoft.com/download/5/D/8/5D8C65CB-C849-4025-8E95-C3966CAFD8AE/vcredist_x86.exe

Visual C++ 2010
Microsoft Visual C++ 2010 Redistributable (x64)
Registry Key: HKLM\SOFTWARE\Classes\Installer\Products\1926E8D15D0BCE53481466615F760A7F
Configuration: x64
Version: 10.0.40219.325
Direct Download URL: https://download.microsoft.com/download/1/6/5/165255E7-1014-4D0A-B094-B6A430A6BFFC/vcredist_x64.exe

Microsoft Visual C++ 2010 Redistributable (x86)
Registry Key: HKLM\SOFTWARE\Classes\Installer\Products\1D5E3C0FEDA1E123187686FED06E995A
Configuration: x86
Version: 10.0.40219.325
Direct Download URL: https://download.microsoft.com/download/1/6/5/165255E7-1014-4D0A-B094-B6A430A6BFFC/vcredist_x86.exe

Visual C++ 2012
Microsoft Visual C++ 2012 Redistributable (x64)
Registry Key: HKLM\SOFTWARE\Classes\Installer\Dependencies\{ca67548a-5ebe-413a-b50c-4b9ceb6d66c6}
Configuration: x64
Version: 11.0.61030.0
Direct Download URL: https://download.microsoft.com/download/1/6/B/16B06F60-3B20-4FF2-B699-5E9B7962F9AE/VSU_4/vcredist_x64.exe

Microsoft Visual C++ 2012 Redistributable (x86)
Registry Key: HKLM\SOFTWARE\Classes\Installer\Dependencies\{33d1fd90-4274-48a1-9bc1-97e33d9c2d6f}
Configuration: x86
Version: 11.0.61030.0
Direct Download URL: https://download.microsoft.com/download/1/6/B/16B06F60-3B20-4FF2-B699-5E9B7962F9AE/VSU_4/vcredist_x86.exe

Visual C++ 2013
Microsoft Visual C++ 2013 Redistributable (x64)
Registry Key: HKLM\SOFTWARE\Classes\Installer\Dependencies\{050d4fc8-5d48-4b8f-8972-47c82c46020f}
Configuration: x64
Version: 12.0.30501.0
Direct Download URL: https://download.microsoft.com/download/2/E/6/2E61CFA4-993B-4DD4-91DA-3737CD5CD6E3/vcredist_x64.exe

Microsoft Visual C++ 2013 Redistributable (x86)
Registry Key: HKLM\SOFTWARE\Classes\Installer\Dependencies\{f65db027-aff3-4070-886a-0d87064aabb1}
Configuration: x86
Version: 12.0.30501.0
Direct Download URL: https://download.microsoft.com/download/2/E/6/2E61CFA4-993B-4DD4-91DA-3737CD5CD6E3/vcredist_x86.exe

Visual C++ 2015
Microsoft Visual C++ 2015 Redistributable (x64) - 14.0.24215
Registry Key: HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Installer\Dependencies\{d992c12e-cab2-426f-bde3-fb8c53950b0d}
Configuration: x64
Version: 14.0.24215.1
Direct Download URL: https://download.microsoft.com/download/6/A/A/6AA4EDFF-645B-48C5-81CC-ED5963AEAD48/vc_redist.x64.exe

Microsoft Visual C++ 2015 Redistributable (x86) - 14.0.24215
Registry Key: HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Installer\Dependencies\{e2803110-78b3-4664-a479-3611a381656a}
Configuration: x86
Version: 14.0.24215.1
Direct Download URL: https://download.microsoft.com/download/6/A/A/6AA4EDFF-645B-48C5-81CC-ED5963AEAD48/vc_redist.x86.exe

Visual C++ 2017
Caveat: There's either a new 2017 registry convention being used, or it hasn't been finalized, yet. As I'm guessing the upper-most keys of: [HKEY_CLASSES_ROOT\Installer\Dependencies\,,amd64,14.0,bundle] and [HKEY_CLASSES_ROOT\Installer\Dependencies\,,x86,14.0,bundle]

are subject to change, or at least have different nested GUIDs, I'm going to use list the key that ends with a GUID.

Microsoft Visual C++ 2017 Redistributable (x64) - 14.11.25325
Registry Key: [HKEY_CLASSES_ROOT\Installer\Dependencies\,,amd64,14.0,bundle\Dependents\{6c6356fe-cbfa-4944-9bed-a9e99f45cb7a}]
Configuration: x64
Version: 14.11.25325.0
Direct Download URL: https://download.visualstudio.microsoft.com/download/pr/11100230/15ccb3f02745c7b206ad10373cbca89b/VC_redist.x64.exe

Microsoft Visual C++ 2017 Redistributable (x86) - 14.11.25325
Registry Key: [HKEY_CLASSES_ROOT\Installer\Dependencies\,,x86,14.0,bundle\Dependents\{404c9c27-8377-4fd1-b607-7ca635db4e49}]
Configuration: x86
Version: 14.11.25325.0
Direct Download URL: https://download.visualstudio.microsoft.com/download/pr/11100229/78c1e864d806e36f6035d80a0e80399e/VC_redist.x86.exe

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM