@@ -38,15 +38,19 @@ function ConfigureBuildEnvironment {
3838 }
3939 {($_ -eq ' 4.5' ) -or ($_ -eq ' 4.5.1' ) -or ($_ -eq ' 4.5.2' )} {
4040 $versions = @ (' v4.0.30319' )
41- $buildToolsVersions = @ (' 15.0' , ' 14.0' , ' 12.0' )
41+ $buildToolsVersions = @ (' 16.0 ' , ' 15.0' , ' 14.0' , ' 12.0' )
4242 }
4343 {($_ -eq ' 4.6' ) -or ($_ -eq ' 4.6.1' ) -or ($_ -eq ' 4.6.2' )} {
4444 $versions = @ (' v4.0.30319' )
45- $buildToolsVersions = @ (' 15.0' , ' 14.0' )
45+ $buildToolsVersions = @ (' 16.0 ' , ' 15.0' , ' 14.0' )
4646 }
4747 {($_ -eq ' 4.7' ) -or ($_ -eq ' 4.7.1' ) -or ($_ -eq ' 4.7.2' )} {
4848 $versions = @ (' v4.0.30319' )
49- $buildToolsVersions = @ (' 15.0' )
49+ $buildToolsVersions = @ (' 16.0' , ' 15.0' )
50+ }
51+ ' 4.8' {
52+ $versions = @ (' v4.0.30319' )
53+ $buildToolsVersions = @ (' 16.0' , ' 15.0' )
5054 }
5155
5256 default {
@@ -102,7 +106,7 @@ function ConfigureBuildEnvironment {
102106
103107 # borrowed from nightroman https://github.com/nightroman/Invoke-Build
104108 if ($vsInstances = Get-VSSetupInstance ) {
105- $vs = @ ($vsInstances | Select-VSSetupInstance - Version ' [15.0,16.0)' - Require Microsoft.Component.MSBuild)
109+ $vs = @ ($vsInstances | Select-VSSetupInstance - Version ' [15.0, 16.0)' - Require Microsoft.Component.MSBuild)
106110 if ($vs ) {
107111 if ($buildToolsKey -eq ' MSBuildToolsPath32' ) {
108112 $frameworkDirs += Join-Path ($vs [0 ].InstallationPath) MSBuild\15.0 \Bin
@@ -112,7 +116,7 @@ function ConfigureBuildEnvironment {
112116 }
113117 }
114118
115- $vs = @ ($vsInstances | Select-VSSetupInstance - Version ' [15.0,16.0)' - Product Microsoft.VisualStudio.Product.BuildTools)
119+ $vs = @ ($vsInstances | Select-VSSetupInstance - Version ' [15.0, 16.0)' - Product Microsoft.VisualStudio.Product.BuildTools)
116120 if ($vs ) {
117121 if ($buildToolsKey -eq ' MSBuildToolsPath32' ) {
118122 $frameworkDirs += Join-Path ($vs [0 ].InstallationPath) MSBuild\15.0 \Bin
@@ -138,6 +142,38 @@ function ConfigureBuildEnvironment {
138142 }
139143 }
140144 }
145+ elseif ($ver -eq " 16.0" ) {
146+ if ($null -eq (Get-Module - Name VSSetup)) {
147+ if ($null -eq (Get-Module - Name VSSetup - ListAvailable)) {
148+ WriteColoredOutput ($msgs.warning_missing_vsssetup_module -f $ver ) - foregroundcolor Yellow
149+ continue
150+ }
151+
152+ Import-Module VSSetup
153+ }
154+
155+ # borrowed from nightroman https://github.com/nightroman/Invoke-Build
156+ if ($vsInstances = Get-VSSetupInstance ) {
157+ $vs = @ ($vsInstances | Select-VSSetupInstance - Version ' [16.0,)' - Require Microsoft.Component.MSBuild)
158+ if ($vs ) {
159+ $frameworkDirs += Join-Path ($vs [0 ].InstallationPath) MSBuild\Current\Bin
160+ }
161+
162+ $vs = @ ($vsInstances | Select-VSSetupInstance - Version ' [16.0,)' - Product Microsoft.VisualStudio.Product.BuildTools)
163+ if ($vs ) {
164+ $frameworkDirs += Join-Path ($vs [0 ].InstallationPath) MSBuild\Current\Bin
165+ }
166+ }
167+ else {
168+ if (! ($root = ${env: ProgramFiles(x86)} )) {$root = $env: ProgramFiles }
169+ if (Test-Path - LiteralPath " $root \Microsoft Visual Studio\2019" ) {
170+ $rp = @ (Resolve-Path " $root \Microsoft Visual Studio\2019\*\MSBuild\Current\Bin" - ErrorAction SilentlyContinue)
171+ if ($rp ) {
172+ $frameworkDirs += $rp [-1 ].ProviderPath
173+ }
174+ }
175+ }
176+ }
141177 elseif (Test-Path " HKLM:\SOFTWARE\Microsoft\MSBuild\ToolsVersions\$ver " ) {
142178 $frameworkDirs += (Get-ItemProperty - Path " HKLM:\SOFTWARE\Microsoft\MSBuild\ToolsVersions\$ver " - Name $buildToolsKey ).$buildToolsKey
143179 }
@@ -156,7 +192,6 @@ function ConfigureBuildEnvironment {
156192 }
157193
158194 $frameworkDirs | ForEach-Object { Assert (test-path $_ - pathType Container) ($msgs.error_no_framework_install_dir_found -f $_ )}
159-
160195 $env: PATH = ($frameworkDirs -join " ;" ) + " ;$env: PATH "
161196 }
162197
0 commit comments