Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save nathancorvussolis/557d1c4faccd5c83d88be606c60430d0 to your computer and use it in GitHub Desktop.
Save nathancorvussolis/557d1c4faccd5c83d88be606c60430d0 to your computer and use it in GitHub Desktop.
WiX v4/v5 - Visual C++ 2015-2022 Redistributable - 14.40.33810
<Wix xmlns="http://wixtoolset.org/schemas/v4/wxs"
xmlns:bal="http://wixtoolset.org/schemas/v4/wxs/bal"
xmlns:util="http://wixtoolset.org/schemas/v4/wxs/util">
<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 &gt;= v6.1">
<BootstrapperApplication>
<bal:WixStandardBootstrapperApplication
LicenseUrl="https://example.net/license.html"
ShowVersion="yes"
SuppressOptionsUI="yes"
Theme="hyperlinkLargeLicense" />
</BootstrapperApplication>
<!-- v6.1 Service Pack 1 -->
<bal:Condition
Message="This application requires Service Pack 1 for Windows 7 / Server 2008 R2."
Condition="NOT ((VersionNT = v6.1) AND (ServicePackLevel &lt; 1))" />
<!-- 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."
Condition="NOT ((VersionNT = v6.3) AND (NT603HALVER &lt; v6.3.9600.17031))" />
<!-- 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 = &quot;AMD64&quot;)"
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 = &quot;ARM64&quot;)"
After="REG_ARCH" />
<!-- Visual C++ 2015-2022 Redistributable runtime msi package version -->
<Variable Name="VCRUNTIME_VER" Type="version" Value="14.40.33810.0" />
<Chain>
<!-- use wix command to get ExePackagePayload attributes -->
<!-- example: wix burn remotepayload VC_redist.x86.exe -out x86.wxs -->
<!-- Visual C++ 2015-2022 Redistributable (x86) - 14.40.33810 -->
<ExePackage
Id="VC_REDIST_X86"
DisplayName="Microsoft Visual C++ 2015-2022 Redistributable (x86) - 14.40.33810"
Cache="remove"
PerMachine="yes"
Permanent="yes"
Protocol="burn"
InstallCondition="VersionNT"
DetectCondition="(VCRUNTIME_X86_VER &gt;= VCRUNTIME_VER) AND VersionNT"
InstallArguments="/install /quiet /norestart"
RepairArguments="/repair /quiet /norestart"
UninstallArguments="/uninstall /quiet /norestart">
<ExePackagePayload
Name="VC_redist.x86.exe"
ProductName="Microsoft Visual C++ 2015-2022 Redistributable (x86) - 14.40.33810"
Description="Microsoft Visual C++ 2015-2022 Redistributable (x86) - 14.40.33810"
Hash="91A6283F774F9E2338B65AA835156854E9E76AED32F821B13CFD070DD6C87E1542CE2D5845BEB5E4AF1DDB102314BB6E0AD6214D896BB3E387590A01EAE0C182"
Size="13867304"
Version="14.40.33810.0"
DownloadUrl="https://download.visualstudio.microsoft.com/download/pr/9c69db26-cda4-472d-bdae-f2b87f4a0177/A32DD41EAAB0C5E1EAA78BE3C0BB73B48593DE8D97A7510B97DE3FD993538600/VC_redist.x86.exe" />
</ExePackage>
<!-- Visual C++ 2015-2022 Redistributable (x64) - 14.40.33810 -->
<ExePackage
Id="VC_REDIST_X64"
DisplayName="Microsoft Visual C++ 2015-2022 Redistributable (x64) - 14.40.33810"
Cache="remove"
PerMachine="yes"
Permanent="yes"
Protocol="burn"
InstallCondition="VersionNT64 AND (ARCH_NAME = &quot;AMD64&quot;)"
DetectCondition="(VCRUNTIME_X64_VER &gt;= VCRUNTIME_VER) AND VersionNT64 AND (ARCH_NAME = &quot;AMD64&quot;)"
InstallArguments="/install /quiet /norestart"
RepairArguments="/repair /quiet /norestart"
UninstallArguments="/uninstall /quiet /norestart">
<ExePackagePayload
Name="VC_redist.x64.exe"
ProductName="Microsoft Visual C++ 2015-2022 Redistributable (x64) - 14.40.33810"
Description="Microsoft Visual C++ 2015-2022 Redistributable (x64) - 14.40.33810"
Hash="5935B69F5138AC3FBC33813C74DA853269BA079F910936AEFA95E230C6092B92F6225BFFB594E5DD35FF29BF260E4B35F91ADEDE90FDF5F062030D8666FD0104"
Size="25397512"
Version="14.40.33810.0"
DownloadUrl="https://download.visualstudio.microsoft.com/download/pr/1754ea58-11a6-44ab-a262-696e194ce543/3642E3F95D50CC193E4B5A0B0FFBF7FE2C08801517758B4C8AEB7105A091208A/VC_redist.x64.exe" />
</ExePackage>
<!-- Visual C++ 2015-2022 Redistributable (Arm64) - 14.40.33810 -->
<ExePackage
Id="VC_REDIST_ARM64"
DisplayName="Microsoft Visual C++ 2015-2022 Redistributable (Arm64) - 14.40.33810"
Cache="remove"
PerMachine="yes"
Permanent="yes"
Protocol="burn"
InstallCondition="(ARCH_NAME = &quot;ARM64&quot;)"
DetectCondition="(VCRUNTIME_ARM64_VER &gt;= VCRUNTIME_VER) AND (ARCH_NAME = &quot;ARM64&quot;)"
InstallArguments="/install /quiet /norestart"
RepairArguments="/repair /quiet /norestart"
UninstallArguments="/uninstall /quiet /norestart">
<ExePackagePayload
Name="VC_redist.arm64.exe"
ProductName="Microsoft Visual C++ 2022 Redistributable (Arm64) - 14.40.33810"
Description="Microsoft Visual C++ 2022 Redistributable (Arm64) - 14.40.33810"
Hash="76A467E992E4F2CBAE261CFB8C64274782E3D420A61F52458662AA1C3A843ED8F4E340D4C237BB080BE1F2E86D7C4E5F4859FFDA8FDCA4E77375FD4D49663D14"
Size="11531032"
Version="14.40.33810.0"
DownloadUrl="https://download.visualstudio.microsoft.com/download/pr/1754ea58-11a6-44ab-a262-696e194ce543/15B8F5B2106DC7A7BD83AB57B796770E0F4ECB891AD19BF655C9D6A9DA650AD2/VC_redist.arm64.exe" />
</ExePackage>
</Chain>
</Bundle>
</Wix>
@Usergitbit
Copy link

Hey, could you tell me how to use this? Is it suppoed to be used directly or referenced as part of another file somehow? Trying to compile it gives me Error (active) WIX0350 The package being validated requires a higher version of Windows Installer than is installed on this machine. Validation cannot continue.

@nathancorvussolis
Copy link
Author

How To Use

  1. Install wix tool
    dotnet tool install wix --global --version 5.0.0

  2. Install wix extensions
    wix extension add --global WixToolset.BootstrapperApplications.wixext/5.0.0
    wix extension add --global WixToolset.Util.wixext/5.0.0

  3. Build
    wix build -arch x86 -ext WixToolset.BootstrapperApplications.wixext -ext WixToolset.Util.wixext -src wix-v5-bootstrap-download-vcredist-sample.wxs -out wix-v5-bootstrap-download-vcredist-sample.exe

I do not know how to fix it. There may be a problem accessing windows installer service.

This error message is implemented here.
https://github.com/wixtoolset/wix/blob/main/src/api/wix/WixToolset.Data/ErrorMessages.cs#L2166
https://github.com/wixtoolset/wix/blob/main/src/api/wix/WixToolset.Data/ErrorMessages.cs#L2610
https://github.com/wixtoolset/wix/blob/main/src/wix/WixToolset.Core.Native/WindowsInstallerValidator.cs#L249

NativeErrorCode "0x64D" means ERROR_INSTALL_PACKAGE_VERSION (1613).
https://learn.microsoft.com/en-us/windows/win32/msi/error-codes

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