Update VCRedist and add a script to update it in the future

This commit is contained in:
Cameron Gutman 2022-08-09 20:09:12 -05:00
parent 15852ccf81
commit 9b29b2702e
2 changed files with 48 additions and 13 deletions

View file

@ -0,0 +1,34 @@
$Urls = [ordered]@{ "X86" = "https://aka.ms/vs/17/release/vc_redist.x86.exe";
"X64" = "https://aka.ms/vs/17/release/vc_redist.x64.exe";
"ARM64" = "https://aka.ms/vs/17/release/vc_redist.arm64.exe"; }
$UpgradeCodes = @{ "X86" = "65E5BD06-6392-3027-8C26-853107D3CF1A";
"X64" = "36F68A90-239C-34DF-B58C-64B30153CE35";
"ARM64" = "DC9BAE42-810B-423A-9E25-E4073F1C7B00"; }
function Get-RedirectTarget([string]$Url) {
return (Invoke-WebRequest -Method Get -Uri $Url -MaximumRedirection 0 -ErrorAction SilentlyContinue).Headers.Location
}
function Print-WixForArch([string]$Arch) {
$targetUrl = Get-RedirectTarget $Urls[$Arch]
$file = "$env:TEMP\\vc_redist.tmp"
Invoke-WebRequest -Method Get -Uri $targetUrl -o $file
$targetSize = (Get-Item $file).Length
$targetVersion = (Get-Command $file).Version
$targetSha1 = (Get-FileHash -Path $file -Algorithm SHA1).Hash
Write-Output "<?define VCREDIST_VER = `"$targetVersion`" ?>"
Write-Output "<?define VCREDIST_$($Arch)_SIZE = `"$targetSize`" ?>"
Write-Output "<?define VCREDIST_$($Arch)_SHA1 = `"$targetSha1`" ?>"
Write-Output "<?define VCREDIST_$($Arch)_URL = `"$targetUrl`" ?>"
Write-Output "<?define VCREDIST_$($Arch)_UPGRADE_CODE = `"$($UpgradeCodes[$Arch])`" ?>"
Remove-Item $file
}
foreach ($arch in $Urls.Keys) {
Print-WixForArch $arch
}

View file

@ -1,17 +1,18 @@
<?xml version="1.0" encoding="UTF-8"?>
<?define VCREDIST_VER = "14.31.31103" ?>
<?define VCREDIST_X86_SIZE = "13725768" ?>
<?define VCREDIST_X86_SHA1 = "15fe8e70c3c5582b70df173cd9b580331677735a" ?>
<?define VCREDIST_X86_URL = "https://download.visualstudio.microsoft.com/download/pr/144a5711-f076-44fa-bf55-f7e0121eb30c/B7AE307237F869E09F7413691A2CD1944357B5CEE28049C0A0D3430B47BB3EDC/VC_redist.x86.exe" ?>
<!-- This block is autogenerated using scripts\update-msvcredist.ps1 -->
<?define VCREDIST_VER = "14.32.31332.0" ?>
<?define VCREDIST_X86_SIZE = "13730768" ?>
<?define VCREDIST_X86_SHA1 = "29E23DD7C19B03EB59304F9D1F8E7209C1167348" ?>
<?define VCREDIST_X86_URL = "https://download.visualstudio.microsoft.com/download/pr/7331f052-6c2d-4890-8041-8058fee5fb0f/CF92A10C62FFAB83B4A2168F5F9A05E5588023890B5C0CC7BA89ED71DA527B0F/VC_redist.x86.exe" ?>
<?define VCREDIST_X86_UPGRADE_CODE = "65E5BD06-6392-3027-8C26-853107D3CF1A" ?>
<?define VCREDIST_X64_SIZE = "25314320" ?>
<?define VCREDIST_X64_SHA1 = "7741a5cad238ce3e4ca7756058f2a67a57fee9d1" ?>
<?define VCREDIST_X64_URL = "https://download.visualstudio.microsoft.com/download/pr/d22ecb93-6eab-4ce1-89f3-97a816c55f04/37ED59A66699C0E5A7EBEEF7352D7C1C2ED5EDE7212950A1B0A8EE289AF4A95B/VC_redist.x64.exe" ?>
<?define VCREDIST_X64_SIZE = "25234792" ?>
<?define VCREDIST_X64_SHA1 = "D4F9181E70E3F1AA6C8EDFFCC15B3C3D4BABE36B" ?>
<?define VCREDIST_X64_URL = "https://download.visualstudio.microsoft.com/download/pr/7331f052-6c2d-4890-8041-8058fee5fb0f/CE6593A1520591E7DEA2B93FD03116E3FC3B3821A0525322B0A430FAA6B3C0B4/VC_redist.x64.exe" ?>
<?define VCREDIST_X64_UPGRADE_CODE = "36F68A90-239C-34DF-B58C-64B30153CE35" ?>
<?define VCREDIST_ARM64_SIZE = "11587336" ?>
<?define VCREDIST_ARM64_SHA1 = "e8316b26bcf8d613b64e6e505507356e2f5c165d" ?>
<?define VCREDIST_ARM64_URL = "https://download.visualstudio.microsoft.com/download/pr/d22ecb93-6eab-4ce1-89f3-97a816c55f04/4671015C191EF3FD276ECE18BD7A5C6D9BFB7BF475ED6526605C82234BEEA581/VC_redist.arm64.exe" ?>
<?define VCREDIST_ARM64_SIZE = "11500416" ?>
<?define VCREDIST_ARM64_SHA1 = "FEECAC80EF04125B058381487332872896F38477" ?>
<?define VCREDIST_ARM64_URL = "https://download.visualstudio.microsoft.com/download/pr/7331f052-6c2d-4890-8041-8058fee5fb0f/8E126191012691AE22A0D5A89FAC01B59BABC7B680E5D9B65828935FD366E375/VC_redist.arm64.exe" ?>
<?define VCREDIST_ARM64_UPGRADE_CODE = "DC9BAE42-810B-423A-9E25-E4073F1C7B00" ?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi"
@ -94,7 +95,7 @@
<RemotePayload Description="Microsoft Visual C++ 2015-2022 Redistributable - x86"
ProductName="Microsoft Visual C++ 2015-2022 Redistributable - x86"
Size="$(var.VCREDIST_X86_SIZE)"
Version="$(var.VCREDIST_VER).0"
Version="$(var.VCREDIST_VER)"
Hash="$(var.VCREDIST_X86_SHA1)"/>
<!-- Newer version installed is fine -->
@ -115,7 +116,7 @@
<RemotePayload Description="Microsoft Visual C++ 2015-2022 Redistributable - x64"
ProductName="Microsoft Visual C++ 2015-2022 Redistributable - x64"
Size="$(var.VCREDIST_X64_SIZE)"
Version="$(var.VCREDIST_VER).0"
Version="$(var.VCREDIST_VER)"
Hash="$(var.VCREDIST_X64_SHA1)"/>
<!-- Newer version installed is fine -->
@ -137,7 +138,7 @@
<RemotePayload Description="Microsoft Visual C++ 2015-2022 Redistributable - ARM64"
ProductName="Microsoft Visual C++ 2015-2022 Redistributable - ARM64"
Size="$(var.VCREDIST_ARM64_SIZE)"
Version="$(var.VCREDIST_VER).0"
Version="$(var.VCREDIST_VER)"
Hash="$(var.VCREDIST_ARM64_SHA1)"/>
<!-- Newer version installed is fine -->