diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..94a9462 --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,74 @@ +name: Automatic Build Script + +on: + schedule: + - cron: "0 0 1,15 * *" + push: + branches: [ main ] + pull_request: + branches: [ main ] + workflow_dispatch: + +permissions: + contents: write + +jobs: + build: + runs-on: ubuntu-24.04 + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Install dependencies + run: | + sudo apt-get update + sudo apt-get install -y aria2 nsis + + - name: Run generate.sh + run: | + chmod +x ./generate_all.sh + ./generate_all.sh + + - name: Get build date + id: date + run: echo "date=$(date +'%Y.%m.%d')" >> $GITHUB_OUTPUT + + - name: Compute SHA256 checksums + id: checksums + run: | + echo "body<> $GITHUB_OUTPUT + echo "Installer build for ${{ steps.date.outputs.date }}" >> $GITHUB_OUTPUT + echo "" >> $GITHUB_OUTPUT + for f in MSVC_Offline_Setup_*.exe; do + sum=$(sha256sum "$f" | awk '{print $1}') + echo "File: $f" >> $GITHUB_OUTPUT + echo "SHA256: $sum" >> $GITHUB_OUTPUT + echo "" >> $GITHUB_OUTPUT + done + echo "EOF" >> $GITHUB_OUTPUT + + - name: Create GitHub Release + uses: softprops/action-gh-release@v2 + with: + tag_name: v${{ steps.date.outputs.date }} + name: Release ${{ steps.date.outputs.date }} + body: | + MSVC Offline Installer build automatically generated on ${{ steps.date.outputs.date }}. It does not include DirectX installation. + + [You can download DirectX Redistributable from here.](https://download.microsoft.com/download/8/4/a/84a35bf1-dafe-4ae8-82af-ad2ae20b6b14/directx_jun2010_redist.exe) + + AllOS variant: Supports at least Windows XP. + Win7 variant: Supports at least Windows 7. + Win10_11 variant: Supports at least Windows 10. + + Following Redistributable Runtime will be installed: + Windows XP: 14.28.29213.0 (2015-2019) + Windows Vista: 14.32.31332.0 (2015-2022) + Windows 7, 8, 8.1: 14.44.35211.0 (2015-2022) + Windows 10, 11: Latest Version when this build is released (2015-2026) + + ${{ steps.checksums.outputs.body }} + files: MSVC_Offline_Setup_*.exe + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/LICENSE b/LICENSE index f6853aa..940f52a 100644 --- a/LICENSE +++ b/LICENSE @@ -1,6 +1,6 @@ MIT License -Copyright (c) 2025 Calyx Hikari +Copyright (c) 2025 Hikari Calyx Tech Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/README.md b/README.md new file mode 100644 index 0000000..833182b --- /dev/null +++ b/README.md @@ -0,0 +1,41 @@ +# get.msvc.win Scripts +This repository served as host of MSVC.win Project. + +## Mirroring +We encourage you to mirror this website, you'll need to follow this requirement: + +- Replace `get.msvc.win` inside of all scripts into your own domain, and your own domain must use msvc as prefix, like `msvc.example.com` + - However, you should not replace the script inside of `$OEM$.zip` + +## Build +This repository also provide automatically generated offline installers. + +If you prefer build yourself, you can follow these procedures: + +### Windows (TBD) + +### Linux +We assume you're using Debian-based Linux distro (e.g. Ubuntu). + +1. Install required dependencies. +```bash +sudo apt-get install aria2 nsis curl +``` + +2. Build installer. +```bash +# Build installer for Windows XP or newer +curl https://get.msvc.win/generate.sh | bash + +# Build installer for Windows 7 or newer +curl https://get.msvc.win/generate.sh | bash -s - win7 + +# Build installer for Windows 10 or newer +curl https://get.msvc.win/generate.sh | bash -s - win10 + +# Build all 3 installers at once +curl https://get.msvc.win/generate_all.sh | bash +``` + +### Contribute +Do you think it needs any improvements? Feel free to create Pull Request. \ No newline at end of file diff --git a/generate.sh b/generate.sh new file mode 100644 index 0000000..d0af1b9 --- /dev/null +++ b/generate.sh @@ -0,0 +1,114 @@ +#!/bin/bash +shopt -s nocasematch + +cat << EOF > downloadLink.txt +https://get.msvc.win/favicon.ico + out=favicon.ico + +https://download.microsoft.com/download/8/b/4/8b42259f-5d70-43f4-ac2e-4b208fd8d66a/vcredist_x86.exe + out=vcredist_2005_x86.exe + +https://download.microsoft.com/download/8/b/4/8b42259f-5d70-43f4-ac2e-4b208fd8d66a/vcredist_x64.exe + out=vcredist_2005_x64.exe + +https://download.microsoft.com/download/5/D/8/5D8C65CB-C849-4025-8E95-C3966CAFD8AE/vcredist_x86.exe + out=vcredist_2008_x86.exe + +https://download.microsoft.com/download/5/D/8/5D8C65CB-C849-4025-8E95-C3966CAFD8AE/vcredist_x64.exe + out=vcredist_2008_x64.exe + +https://download.microsoft.com/download/1/6/5/165255E7-1014-4D0A-B094-B6A430A6BFFC/vcredist_x86.exe + out=vcredist_2010_x86.exe + +https://download.microsoft.com/download/1/6/5/165255E7-1014-4D0A-B094-B6A430A6BFFC/vcredist_x64.exe + out=vcredist_2010_x64.exe + +https://download.microsoft.com/download/1/6/B/16B06F60-3B20-4FF2-B699-5E9B7962F9AE/VSU_4/vcredist_x86.exe + out=vcredist_2012_x86.exe + +https://download.microsoft.com/download/1/6/B/16B06F60-3B20-4FF2-B699-5E9B7962F9AE/VSU_4/vcredist_x64.exe + out=vcredist_2012_x64.exe + +https://aka.ms/highdpimfc2013x86enu + out=vcredist_2013_x86.exe + +https://aka.ms/highdpimfc2013x64enu + out=vcredist_2013_x64.exe +EOF + +if [[ $1 = "win7" || $1 = "win8" ]]; then + script=https://get.msvc.win/install_AtLeastWin7.nsi + cat << EOF >> downloadLink.txt +https://aka.ms/vs/17/release/vc_redist.x86.exe + out=vcredist_v14_nt63_x86.exe + +https://aka.ms/vs/17/release/vc_redist.x64.exe + out=vcredist_v14_nt63_x64.exe + +https://aka.ms/vc14/vc_redist.x86.exe + out=vcredist_v14_latest_x86.exe + +https://aka.ms/vc14/vc_redist.x64.exe + out=vcredist_v14_latest_x64.exe + +${script} + out=installer.nsi +EOF +elif [[ $1 = "win10" ]]; then + script=https://get.msvc.win/install_AtLeastWin10.nsi + cat << EOF >> downloadLink.txt +https://aka.ms/vc14/vc_redist.x86.exe + out=vcredist_v14_latest_x86.exe + +https://aka.ms/vc14/vc_redist.x64.exe + out=vcredist_v14_latest_x64.exe + +${script} + out=installer.nsi +EOF +else + script=https://get.msvc.win/install_AllOS.nsi + cat << EOF >> downloadLink.txt +https://download.visualstudio.microsoft.com/download/pr/566435ac-4e1c-434b-b93f-aecc71e8cffc/0D59EC7FDBF05DE813736BF875CEA5C894FFF4769F60E32E87BD48406BBF0A3A/VC_redist.x86.exe + out=vcredist_v14_nt52_x86.exe + +https://download.visualstudio.microsoft.com/download/pr/566435ac-4e1c-434b-b93f-aecc71e8cffc/B75590149FA14B37997C35724BC93776F67E08BFF9BD5A69FACBF41B3846D084/VC_redist.x64.exe + out=vcredist_v14_nt52_x64.exe + +https://download.visualstudio.microsoft.com/download/pr/ed95ef9e-da02-4735-9064-bd1f7f69b6ed/CF92A10C62FFAB83B4A2168F5F9A05E5588023890B5C0CC7BA89ED71DA527B0F/VC_redist.x86.exe + out=vcredist_v14_nt60_x86.exe + +https://download.visualstudio.microsoft.com/download/pr/ed95ef9e-da02-4735-9064-bd1f7f69b6ed/CE6593A1520591E7DEA2B93FD03116E3FC3B3821A0525322B0A430FAA6B3C0B4/VC_redist.x64.exe + out=vcredist_v14_nt60_x64.exe + +https://aka.ms/vs/17/release/vc_redist.x86.exe + out=vcredist_v14_nt63_x86.exe + +https://aka.ms/vs/17/release/vc_redist.x64.exe + out=vcredist_v14_nt63_x64.exe + +https://aka.ms/vc14/vc_redist.x86.exe + out=vcredist_v14_latest_x86.exe + +https://aka.ms/vc14/vc_redist.x64.exe + out=vcredist_v14_latest_x64.exe + +${script} + out=installer.nsi +EOF +fi + +mkdir msvc_offline +aria2c --dir=msvc_offline --allow-overwrite=true --retry-wait=5 --max-connection-per-server=8 --split=8 --min-split-size=1M -i downloadLink.txt + +pushd msvc_offline +makensis installer.nsi +rm vcredist*.exe +installerFileName=$(ls *.exe) +mv *.exe ../ +popd + +rm -rf msvc_offline + +echo -e "Installer generated. " +echo -e "Filename: ${installerFileName}" \ No newline at end of file diff --git a/generate_all.sh b/generate_all.sh new file mode 100644 index 0000000..4d1a224 --- /dev/null +++ b/generate_all.sh @@ -0,0 +1,86 @@ +#!/bin/bash +shopt -s nocasematch + +cat << EOF > downloadLink.txt +https://get.msvc.win/favicon.ico + out=favicon.ico + +https://download.microsoft.com/download/8/b/4/8b42259f-5d70-43f4-ac2e-4b208fd8d66a/vcredist_x86.exe + out=vcredist_2005_x86.exe + +https://download.microsoft.com/download/8/b/4/8b42259f-5d70-43f4-ac2e-4b208fd8d66a/vcredist_x64.exe + out=vcredist_2005_x64.exe + +https://download.microsoft.com/download/5/D/8/5D8C65CB-C849-4025-8E95-C3966CAFD8AE/vcredist_x86.exe + out=vcredist_2008_x86.exe + +https://download.microsoft.com/download/5/D/8/5D8C65CB-C849-4025-8E95-C3966CAFD8AE/vcredist_x64.exe + out=vcredist_2008_x64.exe + +https://download.microsoft.com/download/1/6/5/165255E7-1014-4D0A-B094-B6A430A6BFFC/vcredist_x86.exe + out=vcredist_2010_x86.exe + +https://download.microsoft.com/download/1/6/5/165255E7-1014-4D0A-B094-B6A430A6BFFC/vcredist_x64.exe + out=vcredist_2010_x64.exe + +https://download.microsoft.com/download/1/6/B/16B06F60-3B20-4FF2-B699-5E9B7962F9AE/VSU_4/vcredist_x86.exe + out=vcredist_2012_x86.exe + +https://download.microsoft.com/download/1/6/B/16B06F60-3B20-4FF2-B699-5E9B7962F9AE/VSU_4/vcredist_x64.exe + out=vcredist_2012_x64.exe + +https://aka.ms/highdpimfc2013x86enu + out=vcredist_2013_x86.exe + +https://aka.ms/highdpimfc2013x64enu + out=vcredist_2013_x64.exe + +https://download.visualstudio.microsoft.com/download/pr/566435ac-4e1c-434b-b93f-aecc71e8cffc/0D59EC7FDBF05DE813736BF875CEA5C894FFF4769F60E32E87BD48406BBF0A3A/VC_redist.x86.exe + out=vcredist_v14_nt52_x86.exe + +https://download.visualstudio.microsoft.com/download/pr/566435ac-4e1c-434b-b93f-aecc71e8cffc/B75590149FA14B37997C35724BC93776F67E08BFF9BD5A69FACBF41B3846D084/VC_redist.x64.exe + out=vcredist_v14_nt52_x64.exe + +https://download.visualstudio.microsoft.com/download/pr/ed95ef9e-da02-4735-9064-bd1f7f69b6ed/CF92A10C62FFAB83B4A2168F5F9A05E5588023890B5C0CC7BA89ED71DA527B0F/VC_redist.x86.exe + out=vcredist_v14_nt60_x86.exe + +https://download.visualstudio.microsoft.com/download/pr/ed95ef9e-da02-4735-9064-bd1f7f69b6ed/CE6593A1520591E7DEA2B93FD03116E3FC3B3821A0525322B0A430FAA6B3C0B4/VC_redist.x64.exe + out=vcredist_v14_nt60_x64.exe + +https://aka.ms/vs/17/release/vc_redist.x86.exe + out=vcredist_v14_nt63_x86.exe + +https://aka.ms/vs/17/release/vc_redist.x64.exe + out=vcredist_v14_nt63_x64.exe + +https://aka.ms/vc14/vc_redist.x86.exe + out=vcredist_v14_latest_x86.exe + +https://aka.ms/vc14/vc_redist.x64.exe + out=vcredist_v14_latest_x64.exe + +https://get.msvc.win/install_AllOS.nsi + out=installer1.nsi + +https://get.msvc.win/install_AtLeastWin7.nsi + out=installer2.nsi + +https://get.msvc.win/install_AtLeastWin10.nsi + out=installer3.nsi +EOF + +mkdir msvc_offline +aria2c --dir=msvc_offline --allow-overwrite=true --retry-wait=5 --max-connection-per-server=8 --split=8 --min-split-size=1M -i downloadLink.txt + +pushd msvc_offline +makensis installer1.nsi +makensis installer2.nsi +makensis installer3.nsi +rm vcredist*.exe +installerFileName=$(ls *.exe) +mv *.exe ../ +popd + +rm -rf msvc_offline + +echo -e "All installer files are generated at current directory. " \ No newline at end of file diff --git a/install_AllOS.nsi b/install_AllOS.nsi new file mode 100644 index 0000000..d64fba6 --- /dev/null +++ b/install_AllOS.nsi @@ -0,0 +1,117 @@ +!include "FileFunc.nsh" +!include "LogicLib.nsh" +!include "WinVer.nsh" +!include "x64.nsh" + +!define /date BUILD_YEAR "%Y" +!define /date BUILD_MONTH "%m" +!define /date BUILD_DAY "%d" + + +Name "MSVC Redistributable Runtime Offline Installer" +Icon "favicon.ico" +OutFile "MSVC_Offline_Setup_${BUILD_YEAR}.${BUILD_MONTH}.${BUILD_DAY}_AllOS.exe" +InstallDir $TEMP + +VIProductVersion "${BUILD_YEAR}.${BUILD_MONTH}.${BUILD_DAY}.0" +VIAddVersionKey /LANG=0x0409 "ProductName" "MSVC Offline Installer" +VIAddVersionKey /LANG=0x0409 "FileDescription" "MSVC Offline Installer" +VIAddVersionKey /LANG=0x0409 "FileVersion" "${BUILD_YEAR}.${BUILD_MONTH}.${BUILD_DAY}.0" +VIAddVersionKey /LANG=0x0409 "LegalCopyright" "msvc.win Project" + +VIAddVersionKey /LANG=0x0804 "ProductName" "MSVC 运行时离线安装程序" +VIAddVersionKey /LANG=0x0804 "FileDescription" "MSVC 运行时离线安装程序" +VIAddVersionKey /LANG=0x0804 "FileVersion" "${BUILD_YEAR}.${BUILD_MONTH}.${BUILD_DAY}.0" +VIAddVersionKey /LANG=0x0804 "LegalCopyright" "msvc.win Project" + +Unicode true +SetCompressor /solid /final lzma +RequestExecutionLevel admin + +Function .onInit +${IfNot} ${AtLeastWinXP} + MessageBox MB_ICONSTOP "This installer requires Windows XP or newer." + Abort +${EndIf} +FunctionEnd + +Section "MSVC Install" + + ; Create a temp folder + SetOutPath $TEMP\vcredist + + ; --- VC++ 2005 --- + File "vcredist_2005_x86.exe" + ExecWait '"$TEMP\vcredist\vcredist_2005_x86.exe" /Q' + ${If} ${RunningX64} + File "vcredist_2005_x64.exe" + ExecWait '"$TEMP\vcredist\vcredist_2005_x64.exe" /Q' + ${EndIf} + + ; --- VC++ 2008 --- + File "vcredist_2008_x86.exe" + ExecWait '"$TEMP\vcredist\vcredist_2008_x86.exe" /Q' + ${If} ${RunningX64} + File "vcredist_2008_x64.exe" + ExecWait '"$TEMP\vcredist\vcredist_2008_x64.exe" /Q' + ${EndIf} + + ; --- VC++ 2010 --- + File "vcredist_2010_x86.exe" + ExecWait '"$TEMP\vcredist\vcredist_2010_x86.exe" /quiet /norestart' + ${If} ${RunningX64} + File "vcredist_2010_x64.exe" + ExecWait '"$TEMP\vcredist\vcredist_2010_x64.exe" /quiet /norestart' + ${EndIf} + + ; --- VC++ 2012 --- + File "vcredist_2012_x86.exe" + ExecWait '"$TEMP\vcredist\vcredist_2012_x86.exe" /quiet /norestart' + ${If} ${RunningX64} + File "vcredist_2012_x64.exe" + ExecWait '"$TEMP\vcredist\vcredist_2012_x64.exe" /quiet /norestart' + ${EndIf} + + ; --- VC++ 2013 --- + File "vcredist_2013_x86.exe" + ExecWait '"$TEMP\vcredist\vcredist_2013_x86.exe" /quiet /norestart' + ${If} ${RunningX64} + File "vcredist_2013_x64.exe" + ExecWait '"$TEMP\vcredist\vcredist_2013_x64.exe" /quiet /norestart' + ${EndIf} + + ; --- VC++ 14 --- + ${If} ${AtMostWin2003} + File /r "vcredist_v14_nt52_x86.exe" + ExecWait '"$TEMP\vcredist\vcredist_v14_nt52_x86.exe" /quiet /norestart' + ${If} ${RunningX64} + File /r "vcredist_v14_nt52_x64.exe" + ExecWait '"$TEMP\vcredist\vcredist_v14_nt52_x64.exe" /quiet /norestart' + ${EndIf} + ${ElseIf} ${IsWinVista} + File "vcredist_v14_nt60_x86.exe" + ExecWait '"$TEMP\vcredist\vcredist_v14_nt60_x86.exe" /quiet /norestart' + ${If} ${RunningX64} + File "vcredist_v14_nt60_x64.exe" + ExecWait '"$TEMP\vcredist\vcredist_v14_nt60_x64.exe" /quiet /norestart' + ${EndIf} + ${ElseIf} ${AtMostWin8} + File "vcredist_v14_nt63_x86.exe" + ExecWait '"$TEMP\vcredist\vcredist_v14_nt63_x86.exe" /quiet /norestart' + ${If} ${RunningX64} + File "vcredist_v14_nt63_x64.exe" + ExecWait '"$TEMP\vcredist\vcredist_v14_nt63_x64.exe" /quiet /norestart' + ${EndIf} + ${Else} + File "vcredist_v14_latest_x86.exe" + ExecWait '"$TEMP\vcredist\vcredist_v14_latest_x86.exe" /quiet /norestart' + ${If} ${RunningX64} + File "vcredist_v14_latest_x64.exe" + ExecWait '"$TEMP\vcredist\vcredist_v14_latest_x64.exe" /quiet /norestart' + ${EndIf} + ${EndIf} + + ; Cleanup + RMDir /r $TEMP\vcredist + +SectionEnd diff --git a/install_AtLeastWin10.nsi b/install_AtLeastWin10.nsi new file mode 100644 index 0000000..71e51c5 --- /dev/null +++ b/install_AtLeastWin10.nsi @@ -0,0 +1,94 @@ +!include "FileFunc.nsh" +!include "LogicLib.nsh" +!include "WinVer.nsh" +!include "x64.nsh" + +!define /date BUILD_YEAR "%Y" +!define /date BUILD_MONTH "%m" +!define /date BUILD_DAY "%d" + + +Name "MSVC Redistributable Runtime Offline Installer" +Icon "favicon.ico" +OutFile "MSVC_Offline_Setup_${BUILD_YEAR}.${BUILD_MONTH}.${BUILD_DAY}_Win10_11.exe" +InstallDir $TEMP + +VIProductVersion "${BUILD_YEAR}.${BUILD_MONTH}.${BUILD_DAY}.0" +VIAddVersionKey /LANG=0x0409 "ProductName" "MSVC Offline Installer" +VIAddVersionKey /LANG=0x0409 "FileDescription" "MSVC Offline Installer" +VIAddVersionKey /LANG=0x0409 "FileVersion" "${BUILD_YEAR}.${BUILD_MONTH}.${BUILD_DAY}.0" +VIAddVersionKey /LANG=0x0409 "LegalCopyright" "msvc.win Project" + +VIAddVersionKey /LANG=0x0804 "ProductName" "MSVC 运行时离线安装程序" +VIAddVersionKey /LANG=0x0804 "FileDescription" "MSVC 运行时离线安装程序" +VIAddVersionKey /LANG=0x0804 "FileVersion" "${BUILD_YEAR}.${BUILD_MONTH}.${BUILD_DAY}.0" +VIAddVersionKey /LANG=0x0804 "LegalCopyright" "msvc.win Project" + +Unicode true +SetCompressor /solid /final lzma +RequestExecutionLevel admin + +Function .onInit +${IfNot} ${AtLeastWin10} + MessageBox MB_ICONSTOP "This installer requires Windows 10 or newer." + Abort +${EndIf} +FunctionEnd + +Section "MSVC Install" + + ; Create a temp folder + SetOutPath $TEMP\vcredist + + ; --- VC++ 2005 --- + File "vcredist_2005_x86.exe" + ExecWait '"$TEMP\vcredist\vcredist_2005_x86.exe" /Q' + ${If} ${RunningX64} + File "vcredist_2005_x64.exe" + ExecWait '"$TEMP\vcredist\vcredist_2005_x64.exe" /Q' + ${EndIf} + + ; --- VC++ 2008 --- + File "vcredist_2008_x86.exe" + ExecWait '"$TEMP\vcredist\vcredist_2008_x86.exe" /Q' + ${If} ${RunningX64} + File "vcredist_2008_x64.exe" + ExecWait '"$TEMP\vcredist\vcredist_2008_x64.exe" /Q' + ${EndIf} + + ; --- VC++ 2010 --- + File "vcredist_2010_x86.exe" + ExecWait '"$TEMP\vcredist\vcredist_2010_x86.exe" /quiet /norestart' + ${If} ${RunningX64} + File "vcredist_2010_x64.exe" + ExecWait '"$TEMP\vcredist\vcredist_2010_x64.exe" /quiet /norestart' + ${EndIf} + + ; --- VC++ 2012 --- + File "vcredist_2012_x86.exe" + ExecWait '"$TEMP\vcredist\vcredist_2012_x86.exe" /quiet /norestart' + ${If} ${RunningX64} + File "vcredist_2012_x64.exe" + ExecWait '"$TEMP\vcredist\vcredist_2012_x64.exe" /quiet /norestart' + ${EndIf} + + ; --- VC++ 2013 --- + File "vcredist_2013_x86.exe" + ExecWait '"$TEMP\vcredist\vcredist_2013_x86.exe" /quiet /norestart' + ${If} ${RunningX64} + File "vcredist_2013_x64.exe" + ExecWait '"$TEMP\vcredist\vcredist_2013_x64.exe" /quiet /norestart' + ${EndIf} + + ; --- VC++ 14 --- + File "vcredist_v14_latest_x86.exe" + ExecWait '"$TEMP\vcredist\vcredist_v14_latest_x86.exe" /quiet /norestart' + ${If} ${RunningX64} + File "vcredist_v14_latest_x64.exe" + ExecWait '"$TEMP\vcredist\vcredist_v14_latest_x64.exe" /quiet /norestart' + ${EndIf} + + ; Cleanup + RMDir /r $TEMP\vcredist + +SectionEnd diff --git a/install_AtLeastWin7.nsi b/install_AtLeastWin7.nsi new file mode 100644 index 0000000..47b32bd --- /dev/null +++ b/install_AtLeastWin7.nsi @@ -0,0 +1,103 @@ +!include "FileFunc.nsh" +!include "LogicLib.nsh" +!include "WinVer.nsh" +!include "x64.nsh" + +!define /date BUILD_YEAR "%Y" +!define /date BUILD_MONTH "%m" +!define /date BUILD_DAY "%d" + + +Name "MSVC Redistributable Runtime Offline Installer" +Icon "favicon.ico" +OutFile "MSVC_Offline_Setup_${BUILD_YEAR}.${BUILD_MONTH}.${BUILD_DAY}_Win7.exe" +InstallDir $TEMP + +VIProductVersion "${BUILD_YEAR}.${BUILD_MONTH}.${BUILD_DAY}.0" +VIAddVersionKey /LANG=0x0409 "ProductName" "MSVC Offline Installer" +VIAddVersionKey /LANG=0x0409 "FileDescription" "MSVC Offline Installer" +VIAddVersionKey /LANG=0x0409 "FileVersion" "${BUILD_YEAR}.${BUILD_MONTH}.${BUILD_DAY}.0" +VIAddVersionKey /LANG=0x0409 "LegalCopyright" "msvc.win Project" + +VIAddVersionKey /LANG=0x0804 "ProductName" "MSVC 运行时离线安装程序" +VIAddVersionKey /LANG=0x0804 "FileDescription" "MSVC 运行时离线安装程序" +VIAddVersionKey /LANG=0x0804 "FileVersion" "${BUILD_YEAR}.${BUILD_MONTH}.${BUILD_DAY}.0" +VIAddVersionKey /LANG=0x0804 "LegalCopyright" "msvc.win Project" + +Unicode true +SetCompressor /solid /final lzma +RequestExecutionLevel admin + +Function .onInit +${IfNot} ${AtLeastWin7} + MessageBox MB_ICONSTOP "This installer requires Windows 7 or newer." + Abort +${EndIf} +FunctionEnd + +Section "MSVC Install" + + ; Create a temp folder + SetOutPath $TEMP\vcredist + + ; --- VC++ 2005 --- + File "vcredist_2005_x86.exe" + ExecWait '"$TEMP\vcredist\vcredist_2005_x86.exe" /Q' + ${If} ${RunningX64} + File "vcredist_2005_x64.exe" + ExecWait '"$TEMP\vcredist\vcredist_2005_x64.exe" /Q' + ${EndIf} + + ; --- VC++ 2008 --- + File "vcredist_2008_x86.exe" + ExecWait '"$TEMP\vcredist\vcredist_2008_x86.exe" /Q' + ${If} ${RunningX64} + File "vcredist_2008_x64.exe" + ExecWait '"$TEMP\vcredist\vcredist_2008_x64.exe" /Q' + ${EndIf} + + ; --- VC++ 2010 --- + File "vcredist_2010_x86.exe" + ExecWait '"$TEMP\vcredist\vcredist_2010_x86.exe" /quiet /norestart' + ${If} ${RunningX64} + File "vcredist_2010_x64.exe" + ExecWait '"$TEMP\vcredist\vcredist_2010_x64.exe" /quiet /norestart' + ${EndIf} + + ; --- VC++ 2012 --- + File "vcredist_2012_x86.exe" + ExecWait '"$TEMP\vcredist\vcredist_2012_x86.exe" /quiet /norestart' + ${If} ${RunningX64} + File "vcredist_2012_x64.exe" + ExecWait '"$TEMP\vcredist\vcredist_2012_x64.exe" /quiet /norestart' + ${EndIf} + + ; --- VC++ 2013 --- + File "vcredist_2013_x86.exe" + ExecWait '"$TEMP\vcredist\vcredist_2013_x86.exe" /quiet /norestart' + ${If} ${RunningX64} + File "vcredist_2013_x64.exe" + ExecWait '"$TEMP\vcredist\vcredist_2013_x64.exe" /quiet /norestart' + ${EndIf} + + ; --- VC++ 14 --- + ${If} ${AtMostWin8} + File "vcredist_v14_nt63_x86.exe" + ExecWait '"$TEMP\vcredist\vcredist_v14_nt63_x86.exe" /quiet /norestart' + ${If} ${RunningX64} + File "vcredist_v14_nt63_x64.exe" + ExecWait '"$TEMP\vcredist\vcredist_v14_nt63_x64.exe" /quiet /norestart' + ${EndIf} + ${Else} + File "vcredist_v14_latest_x86.exe" + ExecWait '"$TEMP\vcredist\vcredist_v14_latest_x86.exe" /quiet /norestart' + ${If} ${RunningX64} + File "vcredist_v14_latest_x64.exe" + ExecWait '"$TEMP\vcredist\vcredist_v14_latest_x64.exe" /quiet /norestart' + ${EndIf} + ${EndIf} + + ; Cleanup + RMDir /r $TEMP\vcredist + +SectionEnd