From 182fbef8451eafb2e658cdfefdd6c191072264e5 Mon Sep 17 00:00:00 2001 From: AnnaOpareva <84513972+AnnaOpareva@users.noreply.github.com> Date: Fri, 10 Sep 2021 17:58:18 +0300 Subject: [PATCH] Fix support VS old versions in VSBuildV1 task (#15271) * fix old versions * bump version Co-authored-by: annaOpareva --- Tasks/VSBuildV1/Get-VSPath.ps1 | 19 ++++++++++--------- Tasks/VSBuildV1/task.json | 2 +- Tasks/VSBuildV1/task.loc.json | 2 +- 3 files changed, 12 insertions(+), 11 deletions(-) diff --git a/Tasks/VSBuildV1/Get-VSPath.ps1 b/Tasks/VSBuildV1/Get-VSPath.ps1 index 5921d4c2fdf2..3606b6512d55 100644 --- a/Tasks/VSBuildV1/Get-VSPath.ps1 +++ b/Tasks/VSBuildV1/Get-VSPath.ps1 @@ -4,25 +4,26 @@ function Get-VSPath { [Parameter(Mandatory = $true)] [string]$Version) - $Versions = @('15.0', '16.0', '17.0') + $Versions = @('10.0', '11.0', '12.0','14.0','15.0', '16.0', '17.0') Trace-VstsEnteringInvocation $MyInvocation try { if ( !($Version -in $Versions )) { - Write-Warning "Please enter one of the versions 15.0, 16.0, 17.0" - } else { + Write-Warning "Please enter one of the versions 10.0, 11.0, 12.0, 14.0, 15.0, 16.0, 17.0" + } else { $VersionNumber = [int]$Version.Remove(2) # Search for more than 15.0 Willow instance. + if ($VersionNumber -ge 15) { if (($instance = Get-VisualStudio $VersionNumber) -and - $instance.installationPath) { - + $instance.installationPath) { return $instance.installationPath - } - + } + } + # Fallback to searching for an older install. if ($path = (Get-ItemProperty -LiteralPath "HKLM:\SOFTWARE\WOW6432Node\Microsoft\VisualStudio\$Version" -Name 'ShellFolder' -ErrorAction Ignore).ShellFolder) { - return $path + return $path } - } + } } finally { Trace-VstsLeavingInvocation $MyInvocation } diff --git a/Tasks/VSBuildV1/task.json b/Tasks/VSBuildV1/task.json index 58a12076a3c6..d0e6bd72dc70 100644 --- a/Tasks/VSBuildV1/task.json +++ b/Tasks/VSBuildV1/task.json @@ -13,7 +13,7 @@ "version": { "Major": 1, "Minor": 192, - "Patch": 2 + "Patch": 3 }, "demands": [ "msbuild", diff --git a/Tasks/VSBuildV1/task.loc.json b/Tasks/VSBuildV1/task.loc.json index 40f2afd27772..dce786c90bb8 100644 --- a/Tasks/VSBuildV1/task.loc.json +++ b/Tasks/VSBuildV1/task.loc.json @@ -13,7 +13,7 @@ "version": { "Major": 1, "Minor": 192, - "Patch": 2 + "Patch": 3 }, "demands": [ "msbuild",