Skip to content

Commit 1d230e3

Browse files
author
Nitin Gurram
authored
Fix checking VS 15 versions. ignore minor version (#5100)
1 parent 86d731c commit 1d230e3

File tree

3 files changed

+24
-24
lines changed

3 files changed

+24
-24
lines changed

Tasks/VsTest/Helpers.ps1

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ function Get-VSTestConsole15Path {
3535
param(
3636
[Parameter(Mandatory = $true)]
3737
[string]$Path)
38-
38+
3939
$shellFolder15 = $Path.TrimEnd('\'[0]) + '\'
4040
$installDir15 = ([System.IO.Path]::Combine($shellFolder15, 'Common7', 'IDE')) + '\'
4141
$testWindowDir15 = [System.IO.Path]::Combine($installDir15, 'CommonExtensions', 'Microsoft', 'TestWindow') + '\'
@@ -363,7 +363,7 @@ namespace CapabilityHelpers.VisualStudio.Setup.Com
363363

364364
return $instances |
365365

366-
Where-Object { $_.Version.Major -eq 15 -and $_.Version.Minor -eq 0 } |
366+
Where-Object { $_.Version.Major -eq 15 } |
367367

368368
Sort-Object -Descending -Property Version |
369369

@@ -383,8 +383,8 @@ function CmdletHasMember {
383383
param(
384384
[string]$memberName
385385
)
386-
387-
$publishParameters = (gcm Publish-TestResults).Parameters.Keys.Contains($memberName)
386+
387+
$publishParameters = (gcm Publish-TestResults).Parameters.Keys.Contains($memberName)
388388
return $publishParameters
389389
}
390390

@@ -394,17 +394,17 @@ function InvokeVsTestCmdletHasMember {
394394
param(
395395
[string]$memberName
396396
)
397-
398-
$invokeVstestParams = (gcm Invoke-VSTest).Parameters.Keys.Contains($memberName)
397+
398+
$invokeVstestParams = (gcm Invoke-VSTest).Parameters.Keys.Contains($memberName)
399399
return $invokeVstestParams
400400
}
401401

402-
function SetRegistryKeyForParallel {
402+
function SetRegistryKeyForParallel {
403403
[cmdletbinding()]
404404
param(
405405
[string]$vsTestVersion
406406
)
407-
407+
408408
$regkey = "HKCU\SOFTWARE\Microsoft\VisualStudio\" + $vsTestVersion + "_Config\FeatureFlags\TestingTools\UnitTesting\Taef"
409409
reg add $regkey /v Value /t REG_DWORD /d 1 /f /reg:32 > $null
410410
}
@@ -421,7 +421,7 @@ function IsVisualStudio2015Update1OrHigherInstalled {
421421
{
422422
$vsTestVersion = Get-VSVersion $vsTestLocation
423423
}
424-
424+
425425
$version = [int]($vsTestVersion)
426426
# with dev15 we are back to vstest and away from taef
427427
if($version -ge 15)
@@ -443,11 +443,11 @@ function IsVisualStudio2015Update1OrHigherInstalled {
443443
# ensure the registry is set otherwise you need to launch VSIDE
444444
SetRegistryKeyForParallel $vsTestVersion
445445
}
446-
446+
447447
return $true
448448
}
449449
}
450-
450+
451451
return $false
452452
}
453453

@@ -461,7 +461,7 @@ function SetupRunSettingsFileForParallel {
461461
)
462462

463463
if($runInParallelFlag -eq "True")
464-
{
464+
{
465465
if([string]::Compare([io.path]::GetExtension($runSettingsFilePath), ".testsettings", $True) -eq 0)
466466
{
467467
Write-Warning "Run in Parallel is not supported with testsettings file."
@@ -480,8 +480,8 @@ function SetupRunSettingsFileForParallel {
480480
</RunSettings>
481481
'
482482
}
483-
else
484-
{
483+
else
484+
{
485485
Write-Verbose "Adding maxcpucount element to runsettings file provided"
486486
$runSettingsForParallel = [System.Xml.XmlDocument](Get-Content $runSettingsFilePath)
487487
$runConfigurationElement = $runSettingsForParallel.SelectNodes("//RunSettings/RunConfiguration")
@@ -494,7 +494,7 @@ function SetupRunSettingsFileForParallel {
494494
if($maxCpuCountElement.Count -eq 0)
495495
{
496496
$newMaxCpuCountElement = $runConfigurationElement.AppendChild($runSettingsForParallel.CreateElement("MaxCpuCount"))
497-
}
497+
}
498498
}
499499

500500
$runSettingsForParallel.RunSettings.RunConfiguration.MaxCpuCount = $defaultCpuCount
@@ -504,7 +504,7 @@ function SetupRunSettingsFileForParallel {
504504
return $tempFile
505505
}
506506
}
507-
507+
508508
return $runSettingsFilePath
509509
}
510510

@@ -534,7 +534,7 @@ function Get-VSVersion($vsTestLocation)
534534
{
535535
return $null
536536
}
537-
537+
538538
$keys = Get-Item $regPath | %{$_.GetSubKeyNames()} -ErrorAction SilentlyContinue
539539
$version = Get-SubKeysInFloatFormat $keys | Sort-Object -Descending | Select-Object -First 1
540540

@@ -548,20 +548,20 @@ function Get-VSVersion($vsTestLocation)
548548
function Get-ResultsLocation {
549549
[cmdletbinding()]
550550
[OutputType([System.String])]
551-
param(
552-
[string]$runSettingsFilePath
551+
param(
552+
[string]$runSettingsFilePath
553553
)
554554

555555
# If this is a runsettings file then try to get the custom results location from it
556-
556+
557557
if(!(CheckIfDirectory $runSettingsFilePath) -And (CheckIfRunsettings $runSettingsFilePath))
558558
{
559559
$runSettingsForTestResults = [System.Xml.XmlDocument](Get-Content $runSettingsFilePath)
560560
$resultsDirElement = $runSettingsForTestResults.SelectNodes("//RunSettings/RunConfiguration/ResultsDirectory")
561561

562562
if($resultsDirElement -And $resultsDirElement.Count -ne 0)
563563
{
564-
$customLocation = $runSettingsForTestResults.RunSettings.RunConfiguration.ResultsDirectory
564+
$customLocation = $runSettingsForTestResults.RunSettings.RunConfiguration.ResultsDirectory
565565
if([io.path]::IsPathRooted($customLocation))
566566
{
567567
return $customLocation
@@ -574,7 +574,7 @@ function Get-ResultsLocation {
574574
return [io.path]::GetFullPath([io.path]::Combine([io.path]::GetDirectoryName($runSettingsFilePath), $customLocation))
575575
}
576576
}
577-
}
577+
}
578578
}
579579

580580
return $null

Tasks/VsTest/task.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
"version": {
1818
"Major": 1,
1919
"Minor": 0,
20-
"Patch": 85
20+
"Patch": 86
2121
},
2222
"demands": [
2323
"vstest"

Tasks/VsTest/task.loc.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
"version": {
1818
"Major": 1,
1919
"Minor": 0,
20-
"Patch": 85
20+
"Patch": 86
2121
},
2222
"demands": [
2323
"vstest"

0 commit comments

Comments
 (0)