Skip to content

Commit 0354809

Browse files
committed
Search Willow for VS by default
1 parent 0f5d329 commit 0354809

19 files changed

+41
-71
lines changed

Tasks/Common/MSBuildHelpers/PathFunctions.ps1

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,13 @@ function Get-MSBuildPath {
55
[CmdletBinding()]
66
param(
77
[string]$Version,
8-
[string]$Architecture,
9-
[switch]$SearchCom)
8+
[string]$Architecture)
109

1110
Trace-VstsEnteringInvocation $MyInvocation
1211
try {
1312
# Attempt to find Microsoft.Build.Utilities.Core.dll from a VS 15 Willow install.
1413
[System.Reflection.Assembly]$msUtilities = $null
15-
if ($SearchCom -and
16-
($visualStudio15 = Get-VisualStudio_15_0) -and
14+
if (($visualStudio15 = Get-VisualStudio_15_0) -and
1715
$visualStudio15.Path) {
1816

1917
$msbuildUtilitiesPath = [System.IO.Path]::Combine($visualStudio15.Path, "MSBuild\15.0\Bin\Microsoft.Build.Utilities.Core.dll")

Tasks/MSBuild/Select-MSBuildLocation.ps1

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,7 @@ function Select-MSBuildLocation {
3333
# Look for a specific version of MSBuild.
3434
if ($Version -and "$Version".ToUpperInvariant() -ne 'LATEST') {
3535

36-
# Only search Willow installs if 15.0 was explicitly chosen.
37-
$searchCom = $Version -eq "15.0"
38-
39-
$Location = Get-MSBuildPath -Version $Version -Architecture $Architecture -SearchCom:$searchCom
36+
$Location = Get-MSBuildPath -Version $Version -Architecture $Architecture
4037

4138
# Warn if not found.
4239
if (!$Location) {
@@ -47,7 +44,7 @@ function Select-MSBuildLocation {
4744
# Look for the latest version of MSBuild.
4845
if (!$Location) {
4946
Write-Verbose 'Searching for latest MSBuild version.'
50-
$Location = Get-MSBuildPath -Version '' -Architecture $Architecture -SearchCom:$false
47+
$Location = Get-MSBuildPath -Version '' -Architecture $Architecture
5148

5249
# Throw if not found.
5350
if (!$Location) {

Tasks/MSBuild/Tests/L0.ts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,9 +45,6 @@ describe('MSBuild Suite', function () {
4545
it('(Select-MSBuildLocation) reverts to version if no location specified', (done) => {
4646
psr.run(path.join(__dirname, 'Select-MSBuildLocation.RevertsToVersionIfNoLocationSpecified.ps1'), done);
4747
})
48-
it('(Select-MSBuildLocation) searches COM for version 15', (done) => {
49-
psr.run(path.join(__dirname, 'Select-MSBuildLocation.SearchesComForVersion15.ps1'), done);
50-
})
5148
it('(Select-MSBuildLocation) throws if version not found', (done) => {
5249
psr.run(path.join(__dirname, 'Select-MSBuildLocation.ThrowsIfVersionNotFound.ps1'), done);
5350
})

Tasks/MSBuild/Tests/Select-MSBuildLocation.DefaultsMethodToVersionIfNoLocation.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ param()
44
# Arrange.
55
. $PSScriptRoot\..\..\..\Tests\lib\Initialize-Test.ps1
66
. $PSScriptRoot\..\Select-MSBuildLocation.ps1
7-
Register-Mock Get-MSBuildPath { 'Some resolved location' } -- -Version '' -Architecture 'Some architecture' -SearchCom: $false # Should not search COM since version is not 15.0.
7+
Register-Mock Get-MSBuildPath { 'Some resolved location' } -- -Version '' -Architecture 'Some architecture'
88

99
# Act.
1010
$actual = Select-MSBuildLocation -Method '' -Location '' -Version '' -Architecture 'Some architecture'

Tasks/MSBuild/Tests/Select-MSBuildLocation.ReturnsLatestVersion.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ param()
44
# Arrange.
55
. $PSScriptRoot\..\..\..\Tests\lib\Initialize-Test.ps1
66
. $PSScriptRoot\..\Select-MSBuildLocation.ps1
7-
Register-Mock Get-MSBuildPath { 'Some resolved location' } -- -Version '' -Architecture 'Some architecture' -SearchCom: $false # Should not search COM since version is not 15.0.
7+
Register-Mock Get-MSBuildPath { 'Some resolved location' } -- -Version '' -Architecture 'Some architecture'
88
foreach ($version in @('', 'latest')) {
99
# Act.
1010
$actual = Select-MSBuildLocation -Method 'Version' -Location 'Some input location' -Version $version -Architecture 'Some architecture'

Tasks/MSBuild/Tests/Select-MSBuildLocation.ReturnsSpecifiedVersion.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ param()
44
# Arrange.
55
. $PSScriptRoot\..\..\..\Tests\lib\Initialize-Test.ps1
66
. $PSScriptRoot\..\Select-MSBuildLocation.ps1
7-
Register-Mock Get-MSBuildPath { 'Some resolved location' } -- -Version '14.0' -Architecture 'Some architecture' -SearchCom: $false # Should not search COM since version is not 15.0.
7+
Register-Mock Get-MSBuildPath { 'Some resolved location' } -- -Version '14.0' -Architecture 'Some architecture'
88

99
# Act.
1010
$actual = Select-MSBuildLocation -Method 'Version' -Location 'Some input location' -Version '14.0' -Architecture 'Some architecture'

Tasks/MSBuild/Tests/Select-MSBuildLocation.RevertsToLatestVersionIfVersionNotFound.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ param()
55
. $PSScriptRoot\..\..\..\Tests\lib\Initialize-Test.ps1
66
. $PSScriptRoot\..\Select-MSBuildLocation.ps1
77
Register-Mock Write-Warning
8-
Register-Mock Get-MSBuildPath { 'Some resolved location' } -- -Version '' -Architecture 'Some architecture' -SearchCom: $false # Should not search COM when falling back to latest.
8+
Register-Mock Get-MSBuildPath { 'Some resolved location' } -- -Version '' -Architecture 'Some architecture'
99

1010
# Act.
1111
$actual = Select-MSBuildLocation -Method 'Version' -Location '' -Version '15.0' -Architecture 'Some architecture'

Tasks/MSBuild/Tests/Select-MSBuildLocation.RevertsToVersionIfNoLocationSpecified.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ param()
44
# Arrange.
55
. $PSScriptRoot\..\..\..\Tests\lib\Initialize-Test.ps1
66
. $PSScriptRoot\..\Select-MSBuildLocation.ps1
7-
Register-Mock Get-MSBuildPath { 'Some resolved location' } -- -Version '' -Architecture 'Some architecture' -SearchCom: $false # Should not search COM version is not 15.0.
7+
Register-Mock Get-MSBuildPath { 'Some resolved location' } -- -Version '' -Architecture 'Some architecture'
88

99
# Act.
1010
$actual = Select-MSBuildLocation -Method 'Location' -Location '' -Version '' -Architecture 'Some architecture'

Tasks/MSBuild/Tests/Select-MSBuildLocation.SearchesComForVersion15.ps1

Lines changed: 0 additions & 13 deletions
This file was deleted.

Tasks/VSBuild/Get-VSPath.ps1

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,12 @@ function Get-VSPath {
22
[CmdletBinding()]
33
param(
44
[Parameter(Mandatory = $true)]
5-
[string]$Version,
6-
7-
[switch]$SearchCom)
5+
[string]$Version)
86

97
Trace-VstsEnteringInvocation $MyInvocation
108
try {
119
# Search for a 15.0 Willow instance.
12-
if ($SearchCom -and
13-
$Version -eq "15.0" -and
10+
if ($Version -eq "15.0" -and
1411
($instance = Get-VisualStudio_15_0) -and
1512
$instance.Path) {
1613

0 commit comments

Comments
 (0)