31
31
)
32
32
33
33
. " .\Get-AutoSDK-PlatformPath.ps1"
34
+ . " .\Get-VisualStudio-Installs.ps1"
34
35
35
36
$AutoSDKRoot = Get-Item - Path $Path - ErrorAction SilentlyContinue
36
37
if (-not $AutoSDKRoot ) {
@@ -50,23 +51,15 @@ if ($Clean) {
50
51
Write-Output " Cleaning AutoSDK platform path: $AutoSDKPlatformPath "
51
52
Remove-Item - Path $AutoSDKPlatformPath - Recurse - Force
52
53
}
53
- $pf = [Environment ]::GetFolderPath(" ProgramFilesx86" )
54
- Write-Output " Program Files: $pf "
55
- # TODO: if powershell 7 use Join-Path enhancements instead of [IO.Path]::Combine?
56
- # $vsWhere = Join-Path $pf "Microsoft Visual Studio" "Installer" "vswhere.exe"
57
- $vsWhere = [IO.Path ]::Combine($pf , " Microsoft Visual Studio" , " Installer" , " vswhere.exe" )
58
- Write-Output " vsWhere path: $vsWhere "
59
- if (-not (Test-Path $vsWhere )) {
60
- Write-Error " vsWhere not found -- are you sure you are running on a machine with Visual Studio 2017 or better installed?"
61
- Exit -1
62
- }
63
- $VSInstalls = (& " $vsWhere " - format json - all - requires Microsoft.Component.MSBuild | ConvertFrom-Json ) # -all -products * -requires Microsoft.VisualStudio.Product.BuildTools -property installationPath | ConvertFrom-Json
54
+
55
+ $VSInstalls = Get-VisualStudio - Installs
64
56
Write-Information " Visual Studio installs: $ ( $VSInstalls.Count ) "
65
57
if ($VSInstalls.Count -eq 0 ) {
66
58
Write-Error " No Visual Studio installs found"
67
59
Exit -1
68
60
}
69
61
Write-Verbose " Visual Studio install 1: $ ( $VSInstalls [0 ]) "
62
+
70
63
$VSInstalls | ForEach-Object {
71
64
$vsPath = $_.installationPath
72
65
$vsVersion = $_.buildVersion
0 commit comments