[wix-users] How to detect latest version of VC++ Runtime?

Harinatha Narisetty harinatha.narisetty at us.abb.com
Thu Feb 15 07:34:07 PST 2018


Hi all,
Can you please tell me how to detect latest version of VC++ runtime installed on a machine?
Our product needs Microsoft Visual C++ 2013 Redistributable  x64 12.0.30501
Currently I have below Wix file to install VC++ before installing the product. But the installation hangs if there is later version of VC++ is already installed on that machine. I want to check if later version of VC++ runtime is already installed and then install this version if needed.

<Fragment>
    <util:RegistrySearch
      Id="VCPLUSPLUS2013"
      Variable="VCPLUSPLUS2013"
      Root="HKLM"
      Key="SOFTWARE\Microsoft\VisualStudio\12.0\VC\Runtimes\x64"
      Value="Installed"
      Result="value" />
  </Fragment>

  <Fragment>
    <util:RegistrySearchRef Id="VCPLUSPLUS2013"/>
    <WixVariable Id="VcPPRedistDetectCondition" Value="VCPLUSPLUS2013 >= 1" Overridable="yes" />
    <WixVariable Id="VcPPRedistInstallCondition" Value="" Overridable="yes" />
    <WixVariable Id="VcPPRedistPackageDirectory" Value="VisualCPlusPlus\" Overridable="yes" />
    <PackageGroup Id="VisualCPlusPlusRedist">
      <ExePackage
          DisplayName="Microsoft Visual C++ 2013 Setup"
          Description="Microsoft Visual C++ 2013 Setup"
          InstallCommand="/q /norestart /ChainingPackage "[WixBundleName]" /log "[VcRedistFullLog].html""
          RepairCommand="/q /norestart /repair /ChainingPackage "[WixBundleName]" /log "[VcRedistFullLog].html""
          UninstallCommand="/uninstall /q /norestart /ChainingPackage "[WixBundleName]" /log "[VcRedistFullLog].html""
          PerMachine="yes"
          DetectCondition="!(wix.VcPPRedistDetectCondition)"
          InstallCondition="!(wix.VcPPRedistInstallCondition)"
          Id="VisualCPlusPlusRedist"
          Vital="yes"
          Permanent="yes"
          LogPathVariable="VcRedistFullLog"
          Compressed="no"
          Name="!(wix.VcPPRedistPackageDirectory)vcredist_x64.exe"
          SourceFile="!(wix.VcPPRedistPackageDirectory)vcredist_x64.exe"
          DownloadUrl="https://download.microsoft.com/download/2/E/6/2E61CFA4-993B-4DD4-91DA-3737CD5CD6E3/vcredist_x64.exe"
          >
      </ExePackage>
    </PackageGroup>
  </Fragment>
</Wix>

Please help me to fix this.



Thanks
Hari


More information about the wix-users mailing list