Skip to content

Instantly share code, notes, and snippets.

@onetown
Created July 6, 2022 05:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save onetown/4a8af37253c6f7ce4d2589c0e9cb382e to your computer and use it in GitHub Desktop.
Save onetown/4a8af37253c6f7ce4d2589c0e9cb382e to your computer and use it in GitHub Desktop.
Section -VCRedist
call installVC
SectionEnd
Section -Webview2
call installWebView2
SectionEnd
Section -DotNet
call installDotNet
SectionEnd
Function installVC
Push $R0
ClearErrors
ReadRegDword $R0 HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{F4499EE3-A166-496C-81BB-51D1BCDC70A9}" "Version"
${if} ${Errors}
${OrIf} $R0 == ""
SetDetailsPrint both
DetailPrint "Installing: VCRedist 2022 x64"
InitPluginsDir
CreateDirectory "$pluginsdir\vcredist"
SetOutPath "$pluginsdir\vcredist"
inetc::get "https://aka.ms/vs/17/release/vc_redist.x64.exe" $pluginsdir\vcredist\vcredist.exe
;File "vcredist.exe"
ExecWait "$pluginsdir\vcredist\vcredist.exe /q"
${EndIf}
FunctionEnd
Function installWebView2
# If this key exists and is not empty then webview2 is already installed
ReadRegStr $0 HKLM \
"SOFTWARE\WOW6432Node\Microsoft\EdgeUpdate\Clients\{F3017226-FE2A-4295-8BDF-00C3A9A7E4C5}" "pv"
${If} ${Errors}
${OrIf} $0 == ""
SetDetailsPrint both
DetailPrint "Installing: WebView2 Runtime"
InitPluginsDir
CreateDirectory "$pluginsdir\webview2bootstrapper"
SetOutPath "$pluginsdir\webview2bootstrapper"
inetc::get "https://go.microsoft.com/fwlink/p/?LinkId=2124703" $pluginsdir\webview2bootstrapper\webview2.exe
;File "MicrosoftEdgeWebview2Setup.exe"
ExecWait '"$pluginsdir\webview2bootstrapper\MicrosoftEdgeWebview2Setup.exe" /silent /install'
SetDetailsPrint both
${EndIf}
FunctionEnd
Function installDotNet
; Magic numbers from http://msdn.microsoft.com/en-us/library/ee942965.aspx
ClearErrors
ReadRegDWORD $0 HKLM "SOFTWARE\Microsoft\NET Framework Setup\NDP\v4\Full" "Release"
IfErrors NotDetected
${If} $0 >= 461814
DetailPrint "Microsoft .NET Framework 4.7.2 is installed ($0)"
${Else}
NotDetected:
DetailPrint "Installing Microsoft .NET Framework 4.8"
SetDetailsPrint listonly
CreateDirectory "$pluginsdir\dotnet"
SetOutPath "$pluginsdir\dotnet"
inetc::get "https://go.microsoft.com/fwlink/?linkid=2088631" $pluginsdir\dotnet\dotnet.exe
;File "dotnet.exe"
ExecWait '"$pluginsdir\dotnet\dotnet.exe" /passive /norestart' $0
${If} $0 == 3010
${OrIf} $0 == 1641
DetailPrint "Microsoft .NET Framework 4.8 installer requested reboot"
SetRebootFlag true
${EndIf}
SetDetailsPrint lastused
DetailPrint "Microsoft .NET Framework 4.8 installer returned $0"
${EndIf}
FunctionEnd
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment