8585 !define MUI_HEADERIMAGE_BITMAP " Extensions\vdlogo.bmp"
8686 !define MUI_HEADERIMAGE_RIGHT
8787 !define MUI_HEADERIMAGE_BITMAP_STRETCH AspectFitHeight
88+ !define MUI_COMPONENTSPAGE_SMALLDESC
8889
8990 !define AUTHOR " Rainer Schuetze"
9091 !define APPNAME " VisualD"
@@ -680,39 +681,16 @@ ${MementoSectionEnd}
680681; --------------------------------
681682${MementoSection} " Install in VS 2022" SecVS2022
682683
683- ; ExecWait 'rundll32 "$INSTDIR\${DLLNAME}" RunDLLRegister ${VS2022_REGISTRY_KEY}'
684- ; WriteRegStr ${VS_REGISTRY_ROOT} "${VS2022_REGISTRY_KEY}${VDSETTINGS_KEY}" "DMDInstallDir" $DMDInstallDir
685- ; ${RegisterWin32Exception} ${VS2022_REGISTRY_KEY} "Win32 Exceptions\D Exception"
686-
687- Call DetectVS2022_InstallationFolder
688- WriteRegStr HKLM " Software\${APPNAME}" " VS2022InstallDir" $1
684+ Push 1
685+ Call InstallForVS2022
689686
690- StrCpy $1 " $1Common7\IDE\"
691- RMDir /r ' $1${EXTENSION_DIR_APP}'
692- ExecWait ' rundll32 "$INSTDIR\${DLLNAME}" WritePackageDef ${VS2022_REGISTRY_KEY} $1${EXTENSION_DIR}\visuald.pkgdef'
693- ${AddItem} " $1${EXTENSION_DIR}\visuald.pkgdef"
694-
695- ${SetOutPath} " $1${EXTENSION_DIR}"
696- ${File} ..\nsis\Extensions_vs15\ extension.vsixmanifest
697- ${File} ..\nsis\Extensions\ vdlogo.ico
698- ${AddItem} " $1${EXTENSION_DIR}"
699-
700- GetFullPathName $0 $INSTDIR
701- !insertmacro ReplaceInFile " $1${EXTENSION_DIR}\extension.vsixmanifest" " VDINSTALLPATH" " $0" NoBackup
702- !insertmacro ReplaceInFile " $1${EXTENSION_DIR}\extension.vsixmanifest" " VSVERSION" " 17" NoBackup
703- !insertmacro ReplaceInFile " $1${EXTENSION_DIR}\extension.vsixmanifest" " VDVERSION" " ${VERSION_MAJOR}.${VERSION_MINOR}" NoBackup
704-
705- !ifdef MAGO
706- ${SetOutPath} " $1..\Packages\Debugger"
707- ${File} ${MAGO_SOURCE} \bin\x64\Release\ MagoNatCC.dll
708- ${File} ${MAGO_SOURCE} \bin\x64\Release\ MagoNatCC.vsdconfig
709- !endif
687+ ${MementoSectionEnd}
710688
711- ${SetOutPath} " $1\PublicAssemblies "
712- ${File } " ..\bin\Release\VisualDWizard\obj\ " VisualDWizard.dll
689+ ; --------------------------------
690+ ${MementoSection } " Install in VS 2022 " SecVS2022_2
713691
714- push $1
715- Call VSConfigurationChanged
692+ Push 2
693+ Call InstallForVS2022
716694
717695${MementoSectionEnd}
718696
@@ -783,6 +761,11 @@ SectionGroup Components
783761${MementoSection} " MSBuild integration" SecMSBuild
784762
785763!ifdef VS2022
764+ SectionGetFlags ${SecVS2022} $2
765+ IntOp $2 $2 & ${SF_SELECTED}
766+ IntCmp $2 ${SF_SELECTED} 0 NoVS2022
767+
768+ Push 1
786769 Call DetectVS2022_InstallationFolder
787770 StrCmp $1 " " NoVS2022
788771 ${RegisterPlatform} " $1\MsBuild\Microsoft\VC\v170" " x64"
@@ -793,9 +776,25 @@ ${MementoSection} "MSBuild integration" SecMSBuild
793776
794777 ExecWait ' rundll32 "$INSTDIR\${DLLNAME}" GenerateGeneralXML ${V170_GENERAL_XML};$INSTDIR\msbuild\general_d.snippet;$INSTDIR\msbuild\general_d.17.0.xml'
795778 ${AddItem} " $INSTDIR\msbuild\general_d.17.0.xml"
796-
797779 NoVS2022:
798780
781+ SectionGetFlags ${SecVS2022_2} $2
782+ IntOp $2 $2 & ${SF_SELECTED}
783+ IntCmp $2 ${SF_SELECTED} 0 NoVS2022_2
784+
785+ Push 2
786+ Call DetectVS2022_InstallationFolder
787+ StrCmp $1 " " NoVS2022_2
788+ ${RegisterPlatform} " $1\MsBuild\Microsoft\VC\v170" " x64"
789+ ${RegisterPlatform} " $1\MsBuild\Microsoft\VC\v170" " Win32"
790+ ${RegisterIcons} " 17.0"
791+
792+ !define V170_GENERAL_XML_2 " $1\MsBuild\Microsoft\VC\v170\1033\general.xml"
793+
794+ ExecWait ' rundll32 "$INSTDIR\${DLLNAME}" GenerateGeneralXML ${V170_GENERAL_XML_2};$INSTDIR\msbuild\general_d.snippet;$INSTDIR\msbuild\general2_d.17.0.xml'
795+ ${AddItem} " $INSTDIR\msbuild\general2_d.17.0.xml"
796+ NoVS2022_2:
797+
799798 Call DetectVS2022BuildTools_InstallationFolder
800799 StrCmp $1 " " NoVS2022BT
801800 ${RegisterPlatform} " $1\Common7\IDE\VC\VCTargets" " x64"
@@ -1056,10 +1055,10 @@ SectionEnd
10561055!endif
10571056!ifdef MAGO
10581057 LangString DESC_SecMago ${LANG_ENGLISH} " Mago is a debug engine especially designed for the D-Language."
1059- LangString DESC_SecMago2 ${LANG_ENGLISH} " $\r$\n Mago is written by Aldo Nunez. Distributed under the Apache License Version 2.0. See www.dsource.org/ projects/mago_debugger"
1058+ LangString DESC_SecMago2 ${LANG_ENGLISH} " $\r$\n Mago is written by Aldo Nunez. Distributed under the Apache License Version 2.0. See www.dsource.org/projects/mago_debugger"
10601059!endif
10611060!ifdef MSBUILD
1062- LangString DESC_SecMSBuild ${LANG_ENGLISH} " MSBuild integration into VC++ projects in VS 2013/15/17/19"
1061+ LangString DESC_SecMSBuild ${LANG_ENGLISH} " MSBuild integration into VC++ projects in VS 2013/15/17/19/22 "
10631062!endif
10641063
10651064 ; Assign language strings to sections
@@ -1083,6 +1082,7 @@ SectionEnd
10831082 !insertmacro MUI_DESCRIPTION_TEXT ${SecVS2017} $(DESC_SecVS2017)
10841083 !insertmacro MUI_DESCRIPTION_TEXT ${SecVS2019} $(DESC_SecVS2019)
10851084 !insertmacro MUI_DESCRIPTION_TEXT ${SecVS2022} $(DESC_SecVS2022)
1085+ !insertmacro MUI_DESCRIPTION_TEXT ${SecVS2022_2} $(DESC_SecVS2022)
10861086 !insertmacro MUI_DESCRIPTION_TEXT ${SecVS2017BT} $(DESC_SecVS2017BT)
10871087 !insertmacro MUI_DESCRIPTION_TEXT ${SecVS2019BT} $(DESC_SecVS2019BT)
10881088 !insertmacro MUI_DESCRIPTION_TEXT ${SecVS2022BT} $(DESC_SecVS2022BT)
@@ -1357,13 +1357,15 @@ Function .onInit
13571357 ReadRegStr $1 ${VS_REGISTRY_ROOT} " ${VS2013_REGISTRY_KEY}" InstallDir
13581358 IfErrors 0 Installed_VS2013
13591359 SectionSetFlags ${SecVS2013} ${SF_RO}
1360+ SectionSetText ${SecVS2013} " "
13601361 Installed_VS2013:
13611362
13621363 ; detect VS2015
13631364 ClearErrors
13641365 ReadRegStr $1 ${VS_REGISTRY_ROOT} " ${VS2015_REGISTRY_KEY}" InstallDir
13651366 IfErrors 0 Installed_VS2015
13661367 SectionSetFlags ${SecVS2015} ${SF_RO}
1368+ SectionSetText ${SecVS2015} " "
13671369 Installed_VS2015:
13681370
13691371 ; detect VS2017
@@ -1402,10 +1404,25 @@ Function .onInit
14021404!ifdef VS2022
14031405 ; detect VS2022
14041406 ClearErrors
1407+ Push 1
14051408 Call DetectVS2022_InstallationFolder
14061409 StrCmp $1 " " 0 Installed_VS2022
14071410 SectionSetFlags ${SecVS2022} ${SF_RO}
1411+ goto Done_VS2022
14081412 Installed_VS2022:
1413+ SectionSetText ${SecVS2022} " Install in $2"
1414+ Done_VS2022:
1415+
1416+ ClearErrors
1417+ Push 2
1418+ Call DetectVS2022_InstallationFolder
1419+ StrCmp $1 " " 0 Installed_VS2022_2
1420+ SectionSetFlags ${SecVS2022_2} ${SF_RO}
1421+ SectionSetText ${SecVS2022_2} " "
1422+ goto Done_VS2022_2
1423+ Installed_VS2022_2:
1424+ SectionSetText ${SecVS2022_2} " Install in $2"
1425+ Done_VS2022_2:
14091426
14101427 ; detect VS2022 Build Tools
14111428 ClearErrors
@@ -1879,7 +1896,9 @@ FunctionEnd
18791896!endif
18801897
18811898!ifdef VS2022
1899+ ; expects index of installation to be pushed as an argument, return folder in $1, display name in $2
18821900Function DetectVS2022_InstallationFolder
1901+ Exch $4
18831902
18841903 StrCpy $0 0
18851904 loop:
@@ -1899,18 +1918,24 @@ Function DetectVS2022_InstallationFolder
18991918 ; MessageBox MB_YESNO|MB_ICONQUESTION "2022 in: '$3'$\n$\nMore?" IDYES 0 IDNO done
19001919 StrCmp $3 " 2022" IsVS2022 NotVS2022
19011920 IsVS2022:
1902- ReadRegStr $2 HKLM SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\$1 InstallLocation
1921+ ReadRegStr $3 HKLM SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\$1 InstallLocation
19031922 IfErrors NoInstallLocation
1904- ; MessageBox MB_YESNO|MB_ICONQUESTION "$2$\n$\nMore?" IDYES 0 IDNO done
1905- StrCpy $1 " $2\\"
1906- return
1923+ ; MessageBox MB_YESNO|MB_ICONQUESTION "$3$\n$\nMore?" IDYES 0 IDNO done
1924+ IntOp $4 $4 - 1
1925+ IntCmp $4 0 idxZero idxNotZero idxNotZero
1926+ idxZero:
1927+ StrCpy $1 " $3\\"
1928+ Pop $4
1929+ return
1930+ idxNotZero:
19071931 NoInstallLocation:
19081932 NotVS2022:
19091933 NoDisplayName:
19101934 IntOp $0 $0 + 1
19111935 Goto loop
19121936 done:
19131937 StrCpy $1 " "
1938+ Pop $4
19141939
19151940FunctionEnd
19161941
@@ -1937,4 +1962,48 @@ Function DetectVS2022BuildTools_InstallationFolder
19371962 StrCpy $1 " "
19381963
19391964FunctionEnd
1940- !endif
1965+
1966+ Function InstallForVS2022
1967+
1968+ Exch $1 ; argument Index
1969+
1970+ ; ExecWait 'rundll32 "$INSTDIR\${DLLNAME}" RunDLLRegister ${VS2022_REGISTRY_KEY}'
1971+ ; WriteRegStr ${VS_REGISTRY_ROOT} "${VS2022_REGISTRY_KEY}${VDSETTINGS_KEY}" "DMDInstallDir" $DMDInstallDir
1972+ ; ${RegisterWin32Exception} ${VS2022_REGISTRY_KEY} "Win32 Exceptions\D Exception"
1973+
1974+ Push $1
1975+ Call DetectVS2022_InstallationFolder
1976+ WriteRegStr HKLM " Software\${APPNAME}" " VS2022InstallDir" $1
1977+
1978+ StrCpy $1 " $1Common7\IDE\"
1979+ RMDir /r ' $1${EXTENSION_DIR_APP}'
1980+ ExecWait ' rundll32 "$INSTDIR\${DLLNAME}" WritePackageDef ${VS2022_REGISTRY_KEY} $1${EXTENSION_DIR}\visuald.pkgdef'
1981+ ${AddItem} " $1${EXTENSION_DIR}\visuald.pkgdef"
1982+
1983+ ${SetOutPath} " $1${EXTENSION_DIR}"
1984+ ${File} ..\nsis\Extensions_vs15\ extension.vsixmanifest
1985+ ${File} ..\nsis\Extensions\ vdlogo.ico
1986+ ${AddItem} " $1${EXTENSION_DIR}"
1987+
1988+ GetFullPathName $0 $INSTDIR
1989+ !insertmacro ReplaceInFile " $1${EXTENSION_DIR}\extension.vsixmanifest" " VDINSTALLPATH" " $0" NoBackup
1990+ !insertmacro ReplaceInFile " $1${EXTENSION_DIR}\extension.vsixmanifest" " VSVERSION" " 17" NoBackup
1991+ !insertmacro ReplaceInFile " $1${EXTENSION_DIR}\extension.vsixmanifest" " VDVERSION" " ${VERSION_MAJOR}.${VERSION_MINOR}" NoBackup
1992+
1993+ !ifdef MAGO
1994+ ${SetOutPath} " $1..\Packages\Debugger"
1995+ ${File} ${MAGO_SOURCE} \bin\x64\Release\ MagoNatCC.dll
1996+ ${File} ${MAGO_SOURCE} \bin\x64\Release\ MagoNatCC.vsdconfig
1997+ !endif
1998+
1999+ ${SetOutPath} " $1\PublicAssemblies"
2000+ ${File} " ..\bin\Release\VisualDWizard\obj\" VisualDWizard.dll
2001+
2002+ push $1
2003+ Call VSConfigurationChanged
2004+
2005+ pop $1
2006+
2007+ FunctionEnd
2008+
2009+ !endif ; VS2022
0 commit comments