Wix Burn vcredist

  1. Deploying vcredist is an appropriate approach to take.

  2. You can use the FileSearch Element (Util Extension) to search for one of the vcredist files and retrieve its version. However this approach is complicated by the fact the burn built in variables SystemFolder and System64Folder are reversed with respect the similar variables in Windows Installer. Example of searches for VC14:

    <!-- Detect existing version of VC ++ 2015 x64 libraries -->
    <util:FileSearch Id="GetVC14X64Exists" Condition="VersionNT64" Variable="vc14x64Exists" Path="[SystemFolder]vcruntime140.dll" Result="exists"/>
    <util:FileSearch Id="GetVC14X64Version" Condition="VersionNT64" Variable="vc14x64Version" Path="[SystemFolder]vcruntime140.dll" Result="version"/>
    
    <!-- Detect existing version of VC ++ 2015 x86 libraries -->
    <util:FileSearch Id="GetVC14X86onX64Exists" Condition="VersionNT64" Variable="vc14x86Exists" Path="[System64Folder]vcruntime140.dll" Result="exists"/>
    <util:FileSearch Id="GetVC14X86onX64Version" Condition="VersionNT64" Variable="vc14x86Version" Path="[System64Folder]vcruntime140.dll" Result="version"/>
    <util:FileSearch Id="GetVC14X86onX86Exists" Condition="NOT VersionNT64" Variable="vc14x86Exists" Path="[SystemFolder]vcruntime140.dll" Result="exists"/>
    <util:FileSearch Id="GetVC14X86onX86Version" Condition="NOT VersionNT64" Variable="vc14x86Version" Path="[SystemFolder]vcruntime140.dll" Result="version"/>
    

    The variables vc14x64Exists and vc14x64Version can then be used in a DetectCondition to work out whether the 64 bit version of VC14 is installed:

    DetectCondition="vc14x64Exists AND vc14x64Version &gt;= v14.0.nnnnn"
    

    Similarly the DetectCondition for the 32 bit version of VC14 is:

    DetectCondition="vc14x86Exists AND vc14x86Version &gt;= v14.0.nnnnn"
    

    Note: In both cases you need to substitute nnnnn with the build number of the vcredist you are including in your installer.

    Edit 1: As an alternative you could detect the presence of VC Redist using an upgrade code search as outlined here.

    Edit 2: In the installers that I author I generally don't try to detect the presence of VC Redist. Instead I let the VC Redist installer run and let itself figure out whether to install, upgrade or do nothing.

  3. To date I've found three versions of the VC14 redist files:

    a) 14.0.23026 - Downloadable from Microsoft's link here.

    b) 14.0.23506 - Provided with Visual Studio 2015 Update 1.

    c) 14.0.23918 - provided with Visual Studio 2015 Update 2.

    Although newer versions of vcredist have been released with Visual Studio updates, Microsoft has not updated the version downloadable from their web site.

  4. You can tell burn to ignore the already installed error code 0x80070666 using <ExitCode Value="1638" Behavior="success"/>. Note that 1638 = 0x666. For example:

    <!-- Microsoft Visual C++ 2015 x86 libraries -->
    <PackageGroup Id="VC14RedistX86">
      <ExePackage
         Cache="no"
         Compressed="yes"
         PerMachine="yes"
         Permanent="yes"
         Vital="yes"
         Name="Redist\vcredist14_x86.exe"
         SourceFile="$(var.RedistPath)\VC14\vcredist_23918_x86.exe"
         InstallCommand="/install /quiet /norestart">
    
         <!-- -->
         <ExitCode Value="3010" Behavior="forceReboot"/>
    
         <!-- Ignore "Newer version installed" error -->
         <ExitCode Value="1638" Behavior="success"/>
      </ExePackage>
    </PackageGroup>
    

I ran into a similar problem recently where a product installer I was working on halted with error 0x80070666. The problem was a newer version of vcredist already installed. The solution I ended up using was: a) include the latest version of vcredist (14.0.23918), and b) add the <ExitCode Value="1638" Behavior="success"/> directive to tell burn not to throw an error if a future newer version of vcredist is already installed.


to detect the presence of a vcredist package you need to search by its UpgradeCode.
this will make sure that also later versions are found.

in a wix burn bootstrapper use util:ProductSearch with the UpgradeCodeparameter. and then specify a minimum version in the DetectCondition.

for full details see this answer of mine: https://stackoverflow.com/a/35889484