blob: b2f18647866e0c28322dd20000804066e0cd5bc9 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
|
[CmdletBinding()]
param(
)
$scriptsDir = split-path -parent $MyInvocation.MyCommand.Definition
$vswhereExe = & $scriptsDir\fetchDependency.ps1 "vswhere"
$output = & $vswhereExe -prerelease -legacy -products * -format xml
[xml]$asXml = $output
$results = New-Object System.Collections.ArrayList
foreach ($instance in $asXml.instances.instance)
{
$installationPath = $instance.InstallationPath -replace "\\$" # Remove potential trailing backslash
$installationVersion = $instance.InstallationVersion
$isPrerelease = $instance.IsPrerelease
if ($isPrerelease -eq 0)
{
$releaseType = "PreferenceWeight3::StableRelease"
}
elseif ($isPrerelease -eq 1)
{
$releaseType = "PreferenceWeight2::PreRelease"
}
else
{
$releaseType = "PreferenceWeight1::Legacy"
}
# Placed like that for easy sorting according to preference
$results.Add("${releaseType}::${installationVersion}::${installationPath}") > $null
}
$results.Sort()
$results.Reverse()
return $results
|