Just for the record, here's my final solution.
Right-click on the bootstrapper project References in Visual Studio and add a reference to WixUtilExtension.
Add xmlns:util="http://schemas.microsoft.com/wix/UtilExtension"
as an attribute to the top level Wix
element.
Add to the <Chain>
element:
<PackageGroupRef Id="vcredist_vc140"/>
Add as a child of the <Wix>
element:
<Fragment>
<!-- vcredist 2015 x86 -->
<util:ProductSearch
Id="VCREDIST_140_x86"
UpgradeCode="65E5BD06-6392-3027-8C26-853107D3CF1A"
Result="version"
Variable="VCREDIST_140_x86"/>
<PackageGroup Id="vcredist_vc140">
<ExePackage
Id="vc140"
Cache="yes"
PerMachine="yes"
Permanent="yes"
Vital="yes"
Compressed="no"
DownloadUrl="http://go.microsoft.com/fwlink/?LinkID=615459"
Name="vcredist_vc140"
InstallCommand="/quiet /norestart"
DetectCondition="(VCREIST_140_x86 >= v14.0.24215)">
<RemotePayload
Description="Microsoft Visual C++ 2015 Redistributable (x86) - 14.0.24215"
ProductName="Microsoft Visual C++ 2015 Redistributable (x86) - 14.0.24215"
Size="14456872"
Version="14.0.24215.1"
Hash="72211BD2E7DFC91EA7C8FAC549C49C0543BA791B" />
</ExePackage>
</PackageGroup>
</Fragment>
UpgradeCode
came from this answer and is specific to v14.0.24215 of the vcredist installer. This is how the bootstrapper decides whether it is already installed.
Compressed="no"
tells the installer not to include the file in the installer itself (since we want to download it from the web).
DownloadUrl
is a direct URL to the downloadable installer from this answer.
RemotePayload Description
is the text of the installer's Description resource and likewise ProductName
. (It appears that the text does not have to match the text in the resources. ProductName
is the description shown in the bootstrapper's progress dialog.)
Size
is the size in bytes.
Hash
is found with the Powershell command get-filehash -algorithm SHA1 .\vc_redist.x86.exe
.
I hope this helps someone.