Skip to content

Commit 16226f7

Browse files
committed
fix #722 DMD Windows installer doesn't detect recent release of VisualStudio
run vswhere.exe from VS installer to detect installation path
1 parent 08fc8d8 commit 16226f7

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

windows/d2-installer.nsi

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,8 @@
7272
!define VCRedistx86RegKey "SOFTWARE\Classes\Installer\Products\1926E8D15D0BCE53481466615F760A7F"
7373
!define VCRedistx64RegKey "SOFTWARE\Classes\Installer\Products\1D5E3C0FEDA1E123187686FED06E995A"
7474

75+
!define VSWhere "${ProgramFiles}\Microsoft Visual Studio\Installer\vswhere.exe"
76+
7577
; ----------------
7678
; Publishing Details
7779
!define DPublisher "D Language Foundation"
@@ -384,6 +386,17 @@ FunctionEnd
384386
Function DetectVC
385387
ClearErrors
386388

389+
IfFileExists "$[VSWhere}" 0 no_vswhere
390+
nsExec::ExecToStack '"${VSWhere}" -products * -prerelease -requires Microsoft.VisualStudio.Component.VC.Tools.x86.x64 -property installationPath'
391+
Pop $1 ; stdout: path
392+
Pop $0 ; result code
393+
StrCmp $0 0 no_vswhere
394+
StrCmp $1 "" no_vswhere
395+
StrCpy $VCVer "VC2017+" ; value not used, but only checked if empty
396+
StrCpy $VCPath $1
397+
Goto done
398+
no_vswhere:
399+
387400
Call DetectVS2019_InstallationFolder
388401
StrCpy $1 "VC2019"
389402
StrCmp $0 "" not_vc2019 vs2019

0 commit comments

Comments
 (0)