2016-03-08 99 views
1

:如何檢測ms vcredist 2013 x86是否存在?
我正在檢查該特定軟件包的Upgrade Id/UpgradeCode,但軟件包總是重新安裝,即使它已經安裝。檢測vcredist 2013 x86的存在 - 在wix burn bootstrapper軟件包中使用UpgradeCode

... 
<Bundle> 
    ... 
    <Chain> 
     <!-- redist packages --> 
     <PackageGroupRef Id="redist"/> 
     ... 
    </Chain> 
</Bundle> 

<Fragment> 
    <PackageGroup Id="redist"> 
     <PackageGroupRef Id="redist_vc120" /> 
     ... 
    </PackageGroup> 
</Fragment> 

<Fragment> 
    <!-- vcredist 2013 x86 --> 
    <?define vcredist2013minversion="12.0.21005"?> 
    <Upgrade Id="B59F5BF1-67C8-3802-8E59-2CE551A39FC5"> 
     <UpgradeVersion Minimum="$(var.vcredist2013minversion)" Property="VCREDIST2013INSTALLED" OnlyDetect="yes" IncludeMinimum="yes" /> 
    </Upgrade> 

    <PackageGroup Id="redist_vc120"> 
     <ExePackage Id="vc120" Cache="yes" PerMachine="yes" Permanent="yes" Vital="yes" Compressed="yes" 
      Name="redist\VC120_Runtime\vcredist_x86.exe" 
      InstallCommand="/quiet /norestart" 
      InstallCondition="Not VCREDIST2013INSTALLED" 
     /> 
    </PackageGroup> 
</Fragment> 
... 

InstallCondition有什麼不對嗎?
或者我需要添加一個DetectCondition

在日誌文件中

記載:

Detected related package: {13A4EE12-23EA-3371-91EE-EFB36DDFFF3E}, scope: PerMachine, version: 12.0.21005.0, language: 0 operation: MajorUpgrade 
Detected package: vc120, state: Absent, cached: None 
Condition 'Not VCREDIST2013INSTALLED' evaluates to true. 
Planned package: vc120, state: Absent, default requested: Present, ba requested: Present, execute: Install, rollback: None, cache: Yes, uncache: No, dependency: None 
Applying execute package: vc120, action: Install, path: <path and command line>... 
Applied execute package: vc120, result: 0x0, restart: None 

而且還消除了InstallCondition並用以下DetectCondition替換它不工作:

<PackageGroup Id="redist_vc120"> 
    <ExePackage Id="vc120" Cache="yes" PerMachine="yes" Permanent="yes" Vital="yes" Compressed="yes" 
     Name="redist\VC120_Runtime\vcredist_x86.exe" 
     InstallCommand="/quiet /norestart" 
     DetectCondition="VCREDIST2013INSTALLED" 
    /> 
</PackageGroup> 

-

編輯:
只是爲了進一步解釋:我試圖與UpgradeCode的方法,因爲我不想檢查對於特定的安裝包,但對於minimum version

回答

3

以下邏輯工作正常的引導程序包(燒傷) :

<Fragment> 
    <!-- vcredist 2013 x86 --> 
    <util:ProductSearch Id="VCREDIST_120_x86" 
     UpgradeCode="B59F5BF1-67C8-3802-8E59-2CE551A39FC5" 
     Result="version" 
     Variable="VCREDIST_120_x86" /> 

    <PackageGroup Id="redist_vc120"> 
     <ExePackage Id="vc120" Cache="yes" PerMachine="yes" Permanent="yes" Vital="yes" Compressed="yes" 
      SourceFile="redist\VC120_Runtime\vcredist_x86.exe" 
      InstallCommand="/quiet /norestart" 
      DetectCondition="(VCREDIST_120_x86 &gt;= v12.0.21005)" /> 
    </PackageGroup> 
</Fragment> 

總結:

  • 它使用util:ProductSearchUpgradeCode參數。
  • 用於檢測,它在DetectCondition中進行版本比較。

產品檢測基礎上的UpgradeCode明顯比工作在MSI(在這裏我們可以用屬性「OnlyDetect」使用升級表一起,然後再配置「LaunchCondition」)不同。


僅供參考:
我發現下面的UpgradeCodes(他們最低版本一起)來匹配...

vcredist 2005 x86 - 86C9D5AA-F00C-4921-B3F2-C60AF92E2844, 8.0.61001 
vcredist 2008 x86 - DE2C306F-A067-38EF-B86C-03DE4B0312F9, 9.0.30729 
vcredist 2010 x86 - 1F4F1D2A-D9DA-32CF-9909-48485DA06DD5, 10.0.40219 
vcredist 2012 x86 - 4121ED58-4BD9-3E7B-A8B5-9F8BAAE045B7, 11.0.61030 
vcredist 2013 x86 - B59F5BF1-67C8-3802-8E59-2CE551A39FC5, 12.0.21005 
vcredist 2015 x86 - 65E5BD06-6392-3027-8C26-853107D3CF1A, 14.0.23506 
vcredist 2017 x86 - C78B8E51-0C65-377E-85D1-282F689FE505, 14.10.25008 
+0

你從哪裏得到這些升級代碼?我想獲得x64的升級代碼,不知道在哪裏尋找。由於 –

+1

以上代碼不匹配我發現了什麼 'vcredist二千零一十七分之二千零一十五86 - C146EF48-4D31-3C3D-A2C5-1E91AF8A0A9B' 'vcredist二千零一十七分之二千零一十五64 - F899BAD3-98ED-308E-A905-56B5338963FF' vcredist是一個包,有一個主要的安裝和擴展安裝MSI,想知道如果上面的ID實際上是子安裝? 使用相同代碼中2015年識別的代碼也適用於2017年 https://gist.github.com/nathancorvussolis/6852ba282647aeb0c5c00e742e28eb48 –

0

我用註冊表檢索算法,以檢查是否安裝,嘗試做如下:

<util:RegistrySearch 
    Root="HKLM" 
    Key="SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\<Place Guid>" 
    Value="DisplayVersion" 
    Variable="MSVC_2013_x64" 
    Win64="yes"/> 

和條件爲:

DetectCondition="MSVC_2013_x64 AND (MSVC_2013_x64 &gt;= v12.0.21005)" 
+0

這個答案檢查的了'ProductCode'重新包裝。因此它將無法檢測到再版軟件包的任何更高版本的Service Pack版本。原始問題詢問如何使用'UpgradeCode'。 – Opmet

+0

爲什麼你需要升級代碼? –

相關問題