2017-01-23 20:53:18 +00:00
|
|
|
[CmdletBinding()]
|
|
|
|
param(
|
|
|
|
|
|
|
|
)
|
|
|
|
|
|
|
|
$scriptsDir = split-path -parent $MyInvocation.MyCommand.Definition
|
|
|
|
$vcpkgRootDir = & $scriptsDir\findFileRecursivelyUp.ps1 $scriptsDir .vcpkg-root
|
|
|
|
|
|
|
|
$downloadsDir = "$vcpkgRootDir\downloads"
|
|
|
|
|
2017-02-17 03:13:10 +00:00
|
|
|
$nugetexe = & $scriptsDir\fetchDependency.ps1 "nuget" 1
|
2017-01-23 20:53:18 +00:00
|
|
|
$nugetPackageDir = "$downloadsDir\nuget-packages"
|
|
|
|
|
2017-03-10 22:10:14 +00:00
|
|
|
$SetupAPIVersion = "1.8.24"
|
2017-02-11 17:51:02 +00:00
|
|
|
$nugetOutput = & $nugetexe install Microsoft.VisualStudio.Setup.Configuration.Native -Version $SetupAPIVersion -OutputDirectory $nugetPackageDir -Source "https://api.nuget.org/v3/index.json" -nocache 2>&1
|
2017-01-23 20:53:18 +00:00
|
|
|
|
|
|
|
$SetupConsoleExe = "$nugetPackageDir\Microsoft.VisualStudio.Setup.Configuration.Native.$SetupAPIVersion\tools\x86\Microsoft.VisualStudio.Setup.Configuration.Console.exe"
|
|
|
|
|
|
|
|
if (!(Test-Path $SetupConsoleExe))
|
|
|
|
{
|
|
|
|
throw $nugetOutput
|
|
|
|
}
|
|
|
|
|
2017-01-25 01:51:45 +00:00
|
|
|
$instances = & $SetupConsoleExe -nologo -value InstallationPath 2>&1
|
|
|
|
$instanceCount = $instances.Length
|
2017-02-08 10:07:53 +00:00
|
|
|
|
2017-01-25 01:51:45 +00:00
|
|
|
# The last item can be empty
|
2017-02-08 10:07:53 +00:00
|
|
|
if ($instanceCount -gt 0 -and $instances[$instanceCount - 1] -eq "")
|
2017-01-25 01:51:45 +00:00
|
|
|
{
|
|
|
|
$instances = $instances[0..($instanceCount - 2)]
|
|
|
|
}
|
2017-01-23 20:53:18 +00:00
|
|
|
|
2017-01-25 01:51:45 +00:00
|
|
|
return $instances
|