aboutsummaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorAlexander Karatarakis <alkarata@microsoft.com>2017-01-23 12:53:18 -0800
committerAlexander Karatarakis <alkarata@microsoft.com>2017-01-23 12:53:18 -0800
commitbb639bfa9c0b21fd7fa5dac3531657a03fbb2b7b (patch)
tree39a888eb886725a6b7f3362d65ca303073c24d75 /scripts
parentd1122c844a17693bde76c5c7d73c83822cd9fb78 (diff)
downloadvcpkg-bb639bfa9c0b21fd7fa5dac3531657a03fbb2b7b.tar.gz
vcpkg-bb639bfa9c0b21fd7fa5dac3531657a03fbb2b7b.zip
[VS2017] Add powershell script to enumerator VS2017 instances
Diffstat (limited to 'scripts')
-rw-r--r--scripts/findVisualStudioInstallationInstances.ps141
1 files changed, 41 insertions, 0 deletions
diff --git a/scripts/findVisualStudioInstallationInstances.ps1 b/scripts/findVisualStudioInstallationInstances.ps1
new file mode 100644
index 000000000..1cb78fa9e
--- /dev/null
+++ b/scripts/findVisualStudioInstallationInstances.ps1
@@ -0,0 +1,41 @@
+[CmdletBinding()]
+param(
+
+)
+
+Import-Module BitsTransfer
+
+$scriptsDir = split-path -parent $MyInvocation.MyCommand.Definition
+$vcpkgRootDir = & $scriptsDir\findFileRecursivelyUp.ps1 $scriptsDir .vcpkg-root
+
+$downloadsDir = "$vcpkgRootDir\downloads"
+
+& $scriptsDir\fetchDependency.ps1 "nuget"
+$nugetexe = "$downloadsDir\nuget.exe"
+$nugetPackageDir = "$downloadsDir\nuget-packages"
+
+$SetupAPIVersion = "1.3.269-rc"
+$url = "https://api.nuget.org/packages/microsoft.visualstudio.setup.configuration.native.$SetupAPIVersion.nupkg"
+$downloadName = "microsoft.visualstudio.setup.configuration.native.$SetupAPIVersion.nupkg"
+$downloadPath = "$downloadsDir\$downloadName"
+
+if (!(Test-Path $downloadPath))
+{
+ Start-BitsTransfer -Source $url -Destination $downloadPath #-ErrorAction SilentlyContinue
+}
+
+$nugetOutput = & $nugetexe install Microsoft.VisualStudio.Setup.Configuration.Native -Pre -Source $downloadsDir -OutputDirectory $nugetPackageDir 2>&1
+
+$SetupConsoleExe = "$nugetPackageDir\Microsoft.VisualStudio.Setup.Configuration.Native.$SetupAPIVersion\tools\x86\Microsoft.VisualStudio.Setup.Configuration.Console.exe"
+
+if (!(Test-Path $SetupConsoleExe))
+{
+ throw $nugetOutput
+}
+
+$consoleOutput = & $SetupConsoleExe 2>&1
+
+$key = "InstallationPath = "
+$paths = $consoleOutput | Select-String -SimpleMatch $key
+$paths = $paths -replace $key, ""
+return $paths \ No newline at end of file