Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Visual C++ 2015-2022 Redistributable - 14.30.30704
<?xml version="1.0" encoding="utf-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi"
xmlns:bal="http://schemas.microsoft.com/wix/BalExtension"
xmlns:util="http://schemas.microsoft.com/wix/UtilExtension">
<!-- Required files -->
<!-- "license.rtf" in bal:WixStandardBootstrapperApplication element -->
<Bundle
Name="Example Product"
Version="1.2.3.4"
Manufacturer="John Doe"
Copyright="© 2021 John Doe"
AboutUrl="https://example.com/"
UpgradeCode="01234567-89AB-CDEF-0123-456789ABCDEF"
Condition="VersionNT >= v6.0">
<BootstrapperApplicationRef
Id="WixStandardBootstrapperApplication.RtfLicense">
<bal:WixStandardBootstrapperApplication
LicenseFile="license.rtf"
ShowVersion="yes"
SuppressOptionsUI="yes" />
</BootstrapperApplicationRef>
<!-- v6.0 Service Pack 2 -->
<bal:Condition Message="This application requires Service Pack 2 for Windows Vista / Server 2008.">
<![CDATA[NOT ((VersionNT = v6.0) AND (ServicePackLevel < 2))]]>
</bal:Condition>
<!-- v6.1 Service Pack 1 -->
<bal:Condition Message="This application requires Service Pack 1 for Windows 7 / Server 2008 R2.">
<![CDATA[NOT ((VersionNT = v6.1) AND (ServicePackLevel < 1))]]>
</bal:Condition>
<!-- v6.3 KB2919355 -->
<util:FileSearch
Id="HAL.DLL"
Path="[WindowsFolder]System32\hal.dll"
Result="version"
Variable="NT603HALVER"
Condition="VersionNT = v6.3" />
<bal:Condition Message="This application requires S14 Update (KB2919355) for Windows 8.1 / Server 2012 R2.">
<![CDATA[NOT ((VersionNT = v6.3) AND (NT603HALVER < v6.3.9600.17031))]]>
</bal:Condition>
<!-- Visual C++ 2015-2022 Redistributable (x64) minimum runtime msi package version -->
<util:ProductSearch
Id="VCRedist2015x64"
Result="version"
Variable="VCRedist2015x64"
UpgradeCode="36F68A90-239C-34DF-B58C-64B30153CE35"
Condition="VersionNT64" />
<!-- Visual C++ 2015-2022 Redistributable (x86) minimum runtime msi package version -->
<util:ProductSearch
Id="VCRedist2015x86"
Result="version"
Variable="VCRedist2015x86"
UpgradeCode="65E5BD06-6392-3027-8C26-853107D3CF1A"
Condition="VersionNT" />
<!-- Visual C++ 2015-2022 Redistributable minimum runtime msi package version -->
<Variable Name="VCRedist2015" Type="version" Value="14.30.30704.0" />
<Chain>
<!-- use heat command to get RemotePayload attributes -->
<!-- example: heat payload vc_redist.x64.exe -o x64.wxs -->
<!-- Visual C++ 2015-2022 Redistributable (x64) - 14.30.30704 -->
<ExePackage
Id="vc_redist.x64.exe"
Name="vc_redist.x64.14.30.30704.0.exe"
DisplayName="Microsoft Visual C++ 2015-2022 Redistributable (x64) - 14.30.30704"
Cache="no"
Compressed="no"
PerMachine="yes"
Permanent="yes"
Protocol="burn"
InstallCondition="VersionNT64"
DetectCondition="VCRedist2015x64 >= VCRedist2015"
DownloadUrl="https://download.visualstudio.microsoft.com/download/pr/2250605e-e48f-43ed-ba6e-e0cc18bc530d/A9F5D2EAF67BF0DB0178B6552A71C523C707DF0E2CC66C06BFBC08BDC53387E7/VC_redist.x64.exe"
InstallCommand="/install /quiet /norestart"
RepairCommand="/repair /quiet /norestart"
UninstallCommand="/uninstall /quiet /norestart" >
<RemotePayload
ProductName="Microsoft Visual C++ 2015-2022 Redistributable (x64) - 14.30.30704"
Description="Microsoft Visual C++ 2015-2022 Redistributable (x64) - 14.30.30704"
Version="14.30.30704.0"
CertificatePublicKey="358CD8B7FB6F985952B53A93374BBB6E1F3DEE08"
CertificateThumbprint="C774204049D25D30AF9AC2F116B3C1FB88EE00A4"
Hash="839E382EBEEF87003FCE57969A79BD58BB264192"
Size="25267128" />
</ExePackage>
<!-- Visual C++ 2015-2022 Redistributable (x86) - 14.30.30704 -->
<ExePackage
Id="vc_redist.x86.exe"
Name="vc_redist.x86.14.30.30704.0.exe"
DisplayName="Microsoft Visual C++ 2015-2022 Redistributable (x86) - 14.30.30704"
Cache="no"
Compressed="no"
PerMachine="yes"
Permanent="yes"
Protocol="burn"
InstallCondition="VersionNT"
DetectCondition="VCRedist2015x86 >= VCRedist2015"
DownloadUrl="https://download.visualstudio.microsoft.com/download/pr/2250605e-e48f-43ed-ba6e-e0cc18bc530d/AC75A82D873E6B6F98B1D293042380764D7D263C43438E50D564FA58C9F891C2/VC_redist.x86.exe"
InstallCommand="/install /quiet /norestart"
RepairCommand="/repair /quiet /norestart"
UninstallCommand="/uninstall /quiet /norestart" >
<RemotePayload
ProductName="Microsoft Visual C++ 2015-2022 Redistributable (x86) - 14.30.30704"
Description="Microsoft Visual C++ 2015-2022 Redistributable (x86) - 14.30.30704"
Version="14.30.30704.0"
CertificatePublicKey="358CD8B7FB6F985952B53A93374BBB6E1F3DEE08"
CertificateThumbprint="C774204049D25D30AF9AC2F116B3C1FB88EE00A4"
Hash="230825953C24344CFB3B1D465F6F50364624B4A6"
Size="13698296" />
</ExePackage>
</Chain>
</Bundle>
</Wix>
@keithyipkw
Copy link

keithyipkw commented Jan 9, 2020

The condition for x86 should be VersionNT&lt;&gt;VersionNT64. VersionNT is the same as VersionNT64 on x64.

@nathancorvussolis
Copy link
Author

nathancorvussolis commented Jan 9, 2020

The condition for x86 should be VersionNT&lt;&gt;VersionNT64. VersionNT is the same as VersionNT64 on x64.

You are right if you don't need x86 modules on 64bit Windows.
This sample installs only x86 module on 32bit Windows, and installs x86 and x64 modules on 64bit Windows.

@keithyipkw
Copy link

keithyipkw commented Jan 9, 2020

The condition for x86 should be VersionNT&lt;&gt;VersionNT64. VersionNT is the same as VersionNT64 on x64.

You are right if you don't need x86 modules on 64bit Windows.
This sample installs only x86 module on 32bit Windows, and installs x86 and x64 modules on 64bit Windows.

I was thinking if InstallCondition="VersionNT" is needed for x86. Then I realize that there are ancient non-NT Windows in the wild which Wix may be able to run on them.

@Coding-Badly
Copy link

Coding-Badly commented Feb 2, 2020

DownloadUrl="https://download.microsoft.com/download/6/A/A/6AA4EDFF-645B-48C5-81CC-ED5963AEAD48/vc_redist.x64.exe"

...is timestamped 2016-Aug-26. The current version is timestamped 2019-Sep-27. This may be a better choice...

DownloadUrl="https://aka.ms/vs/16/release/vc_redist.x64.exe"

@nathancorvussolis
Copy link
Author

nathancorvussolis commented Feb 3, 2020

DownloadUrl="https://download.microsoft.com/download/6/A/A/6AA4EDFF-645B-48C5-81CC-ED5963AEAD48/vc_redist.x64.exe"

...is timestamped 2016-Aug-26. The current version is timestamped 2019-Sep-27. This may be a better choice...

DownloadUrl="https://aka.ms/vs/16/release/vc_redist.x64.exe"

Thanks for your comment. Updated.

URL "https://aka.ms/vs/16/release/vc_redist.x64.exe" is redirected to latest vc redist installer.
We must use non-redirected URL to set RemotePayload attributes, instead of redirected URL like that.
See also https://renderdoc.org/vcredist_symbols/.

@FraukeN
Copy link

FraukeN commented Mar 23, 2020

Do we know what the confidence score on that link is, i.e. how likely is it that MS will decide to put the redistributable somewhere else just because?

@nathancorvussolis
Copy link
Author

nathancorvussolis commented Mar 23, 2020

Do we know what the confidence score on that link is, i.e. how likely is it that MS will decide to put the redistributable somewhere else just because?

No guarantee.
We can use that links now, but maybe these can't be used in future.
If you worry about that, you should bundle redistributable packages in your package without RemotePayload tag and DownloadUrl attribute.

@JVimes
Copy link

JVimes commented Jun 9, 2020

I removed Permanent="yes" from the Redistributable and tried uninstall. They didn't uninstall because VCRedist2015x86 and VCRedist2015x64 were 14.26.28720.0 (instead of 14.26.28720.3), so conditions evaluated false. I changed the VCRedist2015 variable to 14.26.28720.0 and it seems to work. I hope that's a good fix.

@nathancorvussolis
Copy link
Author

nathancorvussolis commented Jun 10, 2020

I removed Permanent="yes" from the Redistributable and tried uninstall. They didn't uninstall because VCRedist2015x86 and VCRedist2015x64 were 14.26.28720.0 (instead of 14.26.28720.3), so conditions evaluated false. I changed the VCRedist2015 variable to 14.26.28720.0 and it seems to work. I hope that's a good fix.

Thank you for your comment. It is fixed.

@drolevar
Copy link

drolevar commented Feb 10, 2021

I'd suggest adding Protocol="burn" to the ExePackage, since vc_redist is also based on Burn, which allows for better progress tracking.

@nathancorvussolis
Copy link
Author

nathancorvussolis commented Feb 11, 2021

I'd suggest adding Protocol="burn" to the ExePackage, since vc_redist is also based on Burn, which allows for better progress tracking.

Thank you for your advice. I updated.

@mladentpdev
Copy link

mladentpdev commented Mar 29, 2021

Hi guys,
I would like to use different version of vs_redist (https://go.microsoft.com/fwlink/?LinkId=615460).
I was wondering how to detect CertificatePublicKey, CertificateThumbprint and Hash for this one?

@drolevar
Copy link

drolevar commented Mar 29, 2021

Hi guys,
I would like to use different version of vs_redist (https://go.microsoft.com/fwlink/?LinkId=615460).
I was wondering how to detect CertificatePublicKey, CertificateThumbprint and Hash for this one?

@mladentpdev There's an article about that: https://stackoverflow.com/questions/12480408/how-to-find-wix-remotepayloads-certificatepublickey-hash/12492704

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment