-
-
Save nathancorvussolis/6852ba282647aeb0c5c00e742e28eb48 to your computer and use it in GitHub Desktop.
<?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"> | |
<Bundle | |
Name="Example Product" | |
Version="1.2.3.4" | |
Manufacturer="John Doe" | |
Copyright="© 2023 John Doe" | |
AboutUrl="https://example.net/" | |
UpgradeCode="01234567-89AB-CDEF-0123-456789ABCDEF" | |
Condition="VersionNT >= v6.1"> | |
<BootstrapperApplicationRef | |
Id="WixStandardBootstrapperApplication.HyperlinkLargeLicense"> | |
<bal:WixStandardBootstrapperApplication | |
LicenseUrl="https://example.net/license.html" | |
ShowVersion="yes" | |
SuppressOptionsUI="yes" /> | |
</BootstrapperApplicationRef> | |
<!-- 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> | |
<!-- processor architecture --> | |
<util:RegistrySearch | |
Id="REG_ARCH" | |
Root="HKLM" | |
Key="SYSTEM\CurrentControlSet\Control\Session Manager\Environment" | |
Value="PROCESSOR_ARCHITECTURE" | |
Result="value" | |
Variable="ARCH_NAME" /> | |
<!-- Visual C++ 2015-2022 Redistributable (x86) runtime minimum msi package version --> | |
<util:ProductSearch | |
Id="VCRUNTIME_X86" | |
Result="version" | |
Variable="VCRUNTIME_X86_VER" | |
UpgradeCode="65E5BD06-6392-3027-8C26-853107D3CF1A" | |
Condition="VersionNT" /> | |
<!-- Visual C++ 2015-2022 Redistributable (x64) runtime minimum msi package version --> | |
<util:ProductSearch | |
Id="VCRUNTIME_X64" | |
Result="version" | |
Variable="VCRUNTIME_X64_VER" | |
UpgradeCode="36F68A90-239C-34DF-B58C-64B30153CE35" | |
Condition="VersionNT64 AND (ARCH_NAME = "AMD64")" | |
After="REG_ARCH" /> | |
<!-- Visual C++ 2015-2022 Redistributable (Arm64) runtime msi package version --> | |
<util:ProductSearch | |
Id="VCRUNTIME_ARM64" | |
Result="version" | |
Variable="VCRUNTIME_ARM64_VER" | |
UpgradeCode="DC9BAE42-810B-423A-9E25-E4073F1C7B00" | |
Condition="(ARCH_NAME = "ARM64")" | |
After="REG_ARCH" /> | |
<!-- Visual C++ 2015-2022 Redistributable runtime msi package version --> | |
<Variable Name="VCRUNTIME_VER" Type="version" Value="14.36.32532.0" /> | |
<Chain> | |
<!-- use heat command to get RemotePayload attributes --> | |
<!-- example: heat payload vc_redist.x86.exe -o x86.wxs --> | |
<!-- Visual C++ 2015-2022 Redistributable (x86) - 14.36.32532 --> | |
<ExePackage | |
Id="VC_REDIST_X86" | |
Name="vc_redist.x86.exe" | |
DisplayName="Microsoft Visual C++ 2015-2022 Redistributable (x86) - 14.36.32532" | |
Cache="no" | |
Compressed="no" | |
PerMachine="yes" | |
Permanent="yes" | |
Protocol="burn" | |
InstallCondition="VersionNT" | |
DetectCondition="(VCRUNTIME_X86_VER >= VCRUNTIME_VER) AND VersionNT" | |
DownloadUrl="https://download.visualstudio.microsoft.com/download/pr/eaab1f82-787d-4fd7-8c73-f782341a0c63/5365A927487945ECB040E143EA770ADBB296074ECE4021B1D14213BDE538C490/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.36.32532" | |
Description="Microsoft Visual C++ 2015-2022 Redistributable (x86) - 14.36.32532" | |
Version="14.36.32532.0" | |
CertificatePublicKey="48DF9B8FC33B59FBA8444CBBF7902089F6CDCC59" | |
CertificateThumbprint="7CB6F13D24E9A7244B65CF7A48E8ED6170CD6C77" | |
Hash="C9B5B7969E499A4FD9E580EF4187322778E1936A" | |
Size="13837672" /> | |
</ExePackage> | |
<!-- Visual C++ 2015-2022 Redistributable (x64) - 14.36.32532 --> | |
<ExePackage | |
Id="VC_REDIST_X64" | |
Name="vc_redist.x64.exe" | |
DisplayName="Microsoft Visual C++ 2015-2022 Redistributable (x64) - 14.36.32532" | |
Cache="no" | |
Compressed="no" | |
PerMachine="yes" | |
Permanent="yes" | |
Protocol="burn" | |
InstallCondition="VersionNT64 AND (ARCH_NAME = "AMD64")" | |
DetectCondition="(VCRUNTIME_X64_VER >= VCRUNTIME_VER) AND VersionNT64 AND (ARCH_NAME = "AMD64")" | |
DownloadUrl="https://download.visualstudio.microsoft.com/download/pr/eaab1f82-787d-4fd7-8c73-f782341a0c63/917C37D816488545B70AFFD77D6E486E4DD27E2ECE63F6BBAAF486B178B2B888/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.36.32532" | |
Description="Microsoft Visual C++ 2015-2022 Redistributable (x64) - 14.36.32532" | |
Version="14.36.32532.0" | |
CertificatePublicKey="48DF9B8FC33B59FBA8444CBBF7902089F6CDCC59" | |
CertificateThumbprint="7CB6F13D24E9A7244B65CF7A48E8ED6170CD6C77" | |
Hash="C483F66C48BA83E99C764D957729789317B09C6B" | |
Size="25355496" /> | |
</ExePackage> | |
<!-- Visual C++ 2015-2022 Redistributable (Arm64) - 14.36.32532 --> | |
<ExePackage | |
Id="VC_REDIST_ARM64" | |
Name="vc_redist.arm64.exe" | |
DisplayName="Microsoft Visual C++ 2015-2022 Redistributable (Arm64) - 14.36.32532" | |
Cache="no" | |
Compressed="no" | |
PerMachine="yes" | |
Permanent="yes" | |
Protocol="burn" | |
InstallCondition="(ARCH_NAME = "ARM64")" | |
DetectCondition="(VCRUNTIME_ARM64_VER >= VCRUNTIME_VER) AND (ARCH_NAME = "ARM64")" | |
DownloadUrl="https://download.visualstudio.microsoft.com/download/pr/eaab1f82-787d-4fd7-8c73-f782341a0c63/37342E0ABDAEAE0297F64A889F842AC9453139639FB0178C0754A7D2F330043A/VC_redist.arm64.exe" | |
InstallCommand="/install /quiet /norestart" | |
RepairCommand="/repair /quiet /norestart" | |
UninstallCommand="/uninstall /quiet /norestart" > | |
<RemotePayload | |
ProductName="Microsoft Visual C++ 2022 Redistributable (Arm64) - 14.36.32532" | |
Description="Microsoft Visual C++ 2022 Redistributable (Arm64) - 14.36.32532" | |
Version="14.36.32532.0" | |
CertificatePublicKey="48DF9B8FC33B59FBA8444CBBF7902089F6CDCC59" | |
CertificateThumbprint="7CB6F13D24E9A7244B65CF7A48E8ED6170CD6C77" | |
Hash="769967FC082DFAF63567328C45DF3F4556EA4697" | |
Size="11511496" /> | |
</ExePackage> | |
</Chain> | |
</Bundle> | |
</Wix> |
The condition for x86 should be
VersionNT<>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.
The condition for x86 should be
VersionNT<>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.
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"
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/.
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?
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.
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.
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.
I'd suggest adding Protocol="burn"
to the ExePackage
, since vc_redist is also based on Burn, which allows for better progress tracking.
I'd suggest adding
Protocol="burn"
to theExePackage
, since vc_redist is also based on Burn, which allows for better progress tracking.
Thank you for your advice. I updated.
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?
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
@mladentpdev There's an article about that: https://stackoverflow.com/questions/12480408/how-to-find-wix-remotepayloads-certificatepublickey-hash/12492704
Thanks.
The condition for x86 should be
VersionNT<>VersionNT64
. VersionNT is the same as VersionNT64 on x64.