Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save nathancorvussolis/557d1c4faccd5c83d88be606c60430d0 to your computer and use it in GitHub Desktop.

Select an option

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

@liangming2003
Copy link

liangming2003 commented Nov 3, 2025

@nathancorvussolis

<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" />

Could you pls tell me where did you get this UpgradeCode? Thanks.

If I need to install a version of 14.44.35208.0 instead of 14.40.33810, do I need to update this UpgradeCode in util:ProductSearch?

  <!-- Visual C++ 2015-2022 Redistributable runtime msi package version -->
  <Variable Name="VCRUNTIME_VER" Type="version" Value="14.44.35208.0" />

@nathancorvussolis
Copy link
Author

In conclusion, you do not need change UpgradeCode.
ProductCode changes with version upgrades, but UpgradeCode does not change with version upgrades for the same product.

https://docs.firegiant.com/wix/tutorial/sprint1/spike-explore-package/#package

https://docs.firegiant.com/wix/schema/wxs/package/

Use wix command like this,

wix burn extract VC_redist.x64.exe -oba outba_dir -o out_dir

See this file,

outba_dir\BootstrapperApplicationData.xml

And you can see UpgradeCode in "vcRuntimeMinimum_x64" package properties.

<WixPackageProperties Package="vcRuntimeMinimum_x64" Vital="yes" DisplayName="Microsoft Visual C++ 2022 X64 Minimum Runtime - 14.44.35211" DownloadSize="1200828" PackageSize="1200828" InstalledSize="2457608" PackageType="Msi" Permanent="no" LogPathVariable="WixBundleLog_vcRuntimeMinimum_x64" RollbackLogPathVariable="WixBundleRollbackLog_vcRuntimeMinimum_x64" Compressed="yes" DisplayInternalUI="no" ProductCode="{43B0D101-A022-48F4-9D04-BA404CEB1D53}" UpgradeCode="{36F68A90-239C-34DF-B58C-64B30153CE35}" Version="14.44.35211" InstallCondition="(VersionNT64) AND NOT (Arm64_Check = &quot;ARM64&quot;)" Cache="yes" />

Or check the msi package file directly with some tool like Orca.exe.

out_dir\WixAttachedContainer\packages\vcRuntimeMinimum_amd64\vc_runtimeMinimum_x64.msi

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