Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 11 additions & 10 deletions Tasks/MSBuildV1/task.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"author": "Microsoft Corporation",
"version": {
"Major": 1,
"Minor": 260,
"Minor": 261,
"Patch": 0
},
"demands": [
Expand Down Expand Up @@ -54,15 +54,16 @@
"defaultValue": "latest",
"helpMarkDown": "If the preferred version cannot be found, the latest version found will be used instead. On an macOS agent, xbuild (Mono) will be used if version is lower than 15.0.",
"visibleRule": "msbuildLocationMethod = version",
"options": {
"latest": "Latest",
"17.0": "MSBuild 17.0",
"16.0": "MSBuild 16.0",
"15.0": "MSBuild 15.0",
"14.0": "MSBuild 14.0",
"12.0": "MSBuild 12.0",
"4.0": "MSBuild 4.0"
}
"options": {
"latest": "Latest",
"18.0": "MSBuild 18.0",
"17.0": "MSBuild 17.0",
"16.0": "MSBuild 16.0",
"15.0": "MSBuild 15.0",
"14.0": "MSBuild 14.0",
"12.0": "MSBuild 12.0",
"4.0": "MSBuild 4.0"
}
},
{
"name": "msbuildArchitecture",
Expand Down
21 changes: 11 additions & 10 deletions Tasks/MSBuildV1/task.loc.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"author": "Microsoft Corporation",
"version": {
"Major": 1,
"Minor": 260,
"Minor": 261,
"Patch": 0
},
"demands": [
Expand Down Expand Up @@ -54,15 +54,16 @@
"defaultValue": "latest",
"helpMarkDown": "ms-resource:loc.input.help.msbuildVersion",
"visibleRule": "msbuildLocationMethod = version",
"options": {
"latest": "Latest",
"17.0": "MSBuild 17.0",
"16.0": "MSBuild 16.0",
"15.0": "MSBuild 15.0",
"14.0": "MSBuild 14.0",
"12.0": "MSBuild 12.0",
"4.0": "MSBuild 4.0"
}
"options": {
"latest": "Latest",
"18.0": "MSBuild 18.0",
"17.0": "MSBuild 17.0",
"16.0": "MSBuild 16.0",
"15.0": "MSBuild 15.0",
"14.0": "MSBuild 14.0",
"12.0": "MSBuild 12.0",
"4.0": "MSBuild 4.0"
}
},
{
"name": "msbuildArchitecture",
Expand Down
4 changes: 2 additions & 2 deletions Tasks/SqlAzureDacpacDeploymentV1/FindSqlPackagePath.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -441,7 +441,7 @@ function Get-VisualStudio_15_0 {
# may be something like 15.2.
Write-Verbose "Getting latest Visual Studio 15 setup instance."
$output = New-Object System.Text.StringBuilder
Invoke-VstsTool -FileName "$PSScriptRoot\vswhere.exe" -Arguments "-version [15.0,18.0) -latest -format json" -RequireExitCodeZero 2>&1 |
Invoke-VstsTool -FileName "$PSScriptRoot\vswhere.exe" -Arguments "-version [15.0,19.0) -latest -format json" -RequireExitCodeZero 2>&1 |
ForEach-Object {
if ($_ -is [System.Management.Automation.ErrorRecord]) {
Write-Verbose "STDERR: $($_.Exception.Message)"
Expand All @@ -460,7 +460,7 @@ function Get-VisualStudio_15_0 {
# the same scheme. It appears to follow the 15.<UPDATE_NUMBER>.* versioning scheme.
Write-Verbose "Getting latest BuildTools 15 setup instance."
$output = New-Object System.Text.StringBuilder
Invoke-VstsTool -FileName "$PSScriptRoot\vswhere.exe" -Arguments "-version [15.0,18.0) -products Microsoft.VisualStudio.Product.BuildTools -latest -format json" -RequireExitCodeZero 2>&1 |
Invoke-VstsTool -FileName "$PSScriptRoot\vswhere.exe" -Arguments "-version [15.0,19.0) -products Microsoft.VisualStudio.Product.BuildTools -latest -format json" -RequireExitCodeZero 2>&1 |
ForEach-Object {
if ($_ -is [System.Management.Automation.ErrorRecord]) {
Write-Verbose "STDERR: $($_.Exception.Message)"
Expand Down
4 changes: 2 additions & 2 deletions Tasks/VSBuildV1/Get-VSPath.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@ function Get-VSPath {
[Parameter(Mandatory = $true)]
[string]$Version)

$Versions = @('10.0', '11.0', '12.0','14.0','15.0', '16.0', '17.0')
$Versions = @('10.0', '11.0', '12.0','14.0','15.0', '16.0', '17.0', '18.0')
Trace-VstsEnteringInvocation $MyInvocation

try {
if ( !($Version -in $Versions )) {
Write-Warning "Please enter one of the versions 10.0, 11.0, 12.0, 14.0, 15.0, 16.0, 17.0"
Write-Warning "Please enter one of the versions 10.0, 11.0, 12.0, 14.0, 15.0, 16.0, 17.0, 18.0"
} else {
$VersionNumber = [int]$Version.Remove(2)
# Search for more than 15.0 Willow instance.
Expand Down
2 changes: 1 addition & 1 deletion Tasks/VSBuildV1/Select-VSVersion.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ function Select-VSVersion {
Trace-VstsEnteringInvocation $MyInvocation
try {
$specificVersion = $PreferredVersion -and $PreferredVersion -ne 'latest'
$versions = '17.0', '16.0', '15.0', '14.0', '12.0', '11.0', '10.0' | Where-Object { $_ -ne $PreferredVersion }
$versions = '18.0', '17.0', '16.0', '15.0', '14.0', '12.0', '11.0', '10.0' | Where-Object { $_ -ne $PreferredVersion }

# Look for a specific version of Visual Studio.
if ($specificVersion) {
Expand Down
1 change: 1 addition & 0 deletions Tasks/VSBuildV1/Tests/MapsVSVersions.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ Register-Mock Invoke-BuildTools
Register-Mock EmitTelemetry
$mappings = @(
@{ VSVersion = '' ; MSBuildVersion = '14.0' }
@{ VSVersion = '18.0' ; MSBuildVersion = '18.0' }
@{ VSVersion = '17.0' ; MSBuildVersion = '17.0' }
@{ VSVersion = '16.0' ; MSBuildVersion = '16.0' }
@{ VSVersion = '15.0' ; MSBuildVersion = '15.0' }
Expand Down
16 changes: 16 additions & 0 deletions Tasks/VSBuildV1/Tests/Select-VSVersion.FallsBackFrom18.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
[CmdletBinding()]
param()

# Arrange.
. $PSScriptRoot\..\..\..\Tests\lib\Initialize-Test.ps1
. $PSScriptRoot\..\Select-VSVersion.ps1
Register-Mock Write-Warning
Register-Mock Get-VSPath { "Some resolved location" } -- -Version '17.0'

# Act.
$actual = Select-VSVersion -PreferredVersion '18.0'

# Assert.
Assert-WasCalled Write-Warning
Assert-WasCalled Get-VSPath -Times 2
Assert-AreEqual -Expected '17.0' -Actual $actual
16 changes: 16 additions & 0 deletions Tasks/VSBuildV1/Tests/Select-VSVersion.FallsForwardFrom17.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
[CmdletBinding()]
param()

# Arrange.
. $PSScriptRoot\..\..\..\Tests\lib\Initialize-Test.ps1
. $PSScriptRoot\..\Select-VSVersion.ps1
Register-Mock Write-Warning
Register-Mock Get-VSPath { "Some resolved location" } -- -Version '18.0'

# Act.
$actual = Select-VSVersion -PreferredVersion '17.0'

# Assert.
Assert-WasCalled Write-Warning
Assert-WasCalled Get-VSPath -Times 2
Assert-AreEqual -Expected '18.0' -Actual $actual
2 changes: 1 addition & 1 deletion Tasks/VSBuildV1/Tests/Select-VSVersion.FindsLatest.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ param()
. $PSScriptRoot\..\..\..\Tests\lib\Initialize-Test.ps1
. $PSScriptRoot\..\Select-VSVersion.ps1
$preferredVersions = '', 'latest'
$knownVersions = '10.0', '11.0', '12.0', '14.0', '15.0', '16.0', '17.0' # Registered in ascending order to validate latest is searched first.
$knownVersions = '10.0', '11.0', '12.0', '14.0', '15.0', '16.0', '17.0', '18.0' # Registered in ascending order to validate latest is searched first.
foreach ($preferredVersion in $preferredVersions) {
Unregister-Mock Get-VSPath
foreach ($knownVersion in $knownVersions) {
Expand Down
1 change: 1 addition & 0 deletions Tasks/VSBuildV1/VSBuild.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ try {
$msBuildVersion = $null;
switch ("$vsVersion") {
'' { $msBuildVersion = '14.0' ; break } # VS wasn't found. Attempt to find MSBuild 14.0 or lower.
'18.0' { $msBuildVersion = '18.0' ; break }
'17.0' { $msBuildVersion = '17.0' ; break }
'16.0' { $msBuildVersion = '16.0' ; break }
'15.0' { $msBuildVersion = '15.0' ; break }
Expand Down
2 changes: 1 addition & 1 deletion Tasks/VSBuildV1/task.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"author": "Microsoft Corporation",
"version": {
"Major": 1,
"Minor": 263,
"Minor": 264,
"Patch": 0
},
"demands": [
Expand Down
21 changes: 18 additions & 3 deletions Tasks/VsTestV2/inputparser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,8 @@ function getTestPlatformSettings(inputDataContract : idc.InputDataContract) : id

ci.publishEvent({ subFeature: 'ToolsInstallerInstallationSuccessful' });

} else if ((vsTestVersion !== '17.0')
} else if ((vsTestVersion !== '18.0')
&& (vsTestVersion !== '17.0')
&& (vsTestVersion !== '16.0')
&& (vsTestVersion !== '15.0')
&& (vsTestVersion !== '14.0')
Expand Down Expand Up @@ -531,11 +532,17 @@ function getTestPlatformPath(inputDataContract : idc.InputDataContract) {

if (vsTestVersion.toLowerCase() === 'latest') {
tl.debug('Searching for latest Visual Studio.');
let vstestconsolePath = getVSTestConsolePath('17.0', '18.0');
let vstestconsolePath = getVSTestConsolePath('18.0', '19.0');
if (vstestconsolePath) {
return path.join(vstestconsolePath, 'Common7', 'IDE', 'Extensions', 'TestPlatform');
}
vstestconsolePath = getVSTestConsolePath('16.0', '17.0');

vstestconsolePath = getVSTestConsolePath('17.0', '18.0');
if (vstestconsolePath) {
return path.join(vstestconsolePath, 'Common7', 'IDE', 'Extensions', 'TestPlatform');
}

vstestconsolePath = getVSTestConsolePath('16.0', '17.0');
if (vstestconsolePath) {
return path.join(vstestconsolePath, 'Common7', 'IDE', 'Extensions', 'TestPlatform');
}
Expand All @@ -553,6 +560,14 @@ function getTestPlatformPath(inputDataContract : idc.InputDataContract) {

const vsVersion: number = parseFloat(vsTestVersion);

if (vsVersion === 18.0) {
const vstestconsolePath = getVSTestConsolePath('18.0', '19.0');
if (vstestconsolePath) {
return path.join(vstestconsolePath, 'Common7', 'IDE', 'Extensions', 'TestPlatform');
}
throw (new Error(tl.loc('VstestNotFound', utils.Helper.getVSVersion(vsVersion))));
}

if (vsVersion === 17.0) {
const vstestconsolePath = getVSTestConsolePath('17.0', '18.0');
if (vstestconsolePath) {
Expand Down
19 changes: 10 additions & 9 deletions Tasks/VsTestV2/task.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"author": "Microsoft Corporation",
"version": {
"Major": 2,
"Minor": 261,
"Minor": 262,
"Patch": 0
},
"demands": [
Expand Down Expand Up @@ -214,14 +214,15 @@
"helpMarkDown": "The version of Visual Studio test to use. If latest is specified it chooses latest Visual Studio version starting from VS2022 followed by VS2019, VS2017 and VS2015 depending on what is installed. Visual Studio 2013 is not supported. To run tests without needing Visual Studio on the agent, use the ‘Installed by tools installer’ option. Be sure to include the ‘Visual Studio Test Platform Installer’ task to acquire the test platform from nuget.",
"visibleRule": "vstestLocationMethod = version",
"groupName": "executionOptions",
"options": {
"latest": "Latest",
"17.0": "Visual Studio 2022",
"16.0": "Visual Studio 2019",
"15.0": "Visual Studio 2017",
"14.0": "Visual Studio 2015",
"toolsInstaller": "Installed by Tools Installer"
},
"options": {
"latest": "Latest",
"18.0": "Visual Studio 2026",
"17.0": "Visual Studio 2022",
"16.0": "Visual Studio 2019",
"15.0": "Visual Studio 2017",
"14.0": "Visual Studio 2015",
"toolsInstaller": "Installed by Tools Installer"
},
"properties": {
"EditableOptions": "True"
}
Expand Down
19 changes: 10 additions & 9 deletions Tasks/VsTestV2/task.loc.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"author": "Microsoft Corporation",
"version": {
"Major": 2,
"Minor": 261,
"Minor": 262,
"Patch": 0
},
"demands": [
Expand Down Expand Up @@ -214,14 +214,15 @@
"helpMarkDown": "ms-resource:loc.input.help.vsTestVersion",
"visibleRule": "vstestLocationMethod = version",
"groupName": "executionOptions",
"options": {
"latest": "Latest",
"17.0": "Visual Studio 2022",
"16.0": "Visual Studio 2019",
"15.0": "Visual Studio 2017",
"14.0": "Visual Studio 2015",
"toolsInstaller": "Installed by Tools Installer"
},
"options": {
"latest": "Latest",
"18.0": "Visual Studio 2026",
"17.0": "Visual Studio 2022",
"16.0": "Visual Studio 2019",
"15.0": "Visual Studio 2017",
"14.0": "Visual Studio 2015",
"toolsInstaller": "Installed by Tools Installer"
},
"properties": {
"EditableOptions": "True"
}
Expand Down
3 changes: 2 additions & 1 deletion Tasks/VsTestV2/taskinputparser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,8 @@ function initTestConfigurations(testConfiguration: models.TestConfigurations) {
testConfiguration.vsTestLocation = testConfiguration.toolsInstallerConfig.vsTestConsolePathFromPackageLocation;

testConfiguration.toolsInstallerConfig.isToolsInstallerInUse = true;
} else if ((testConfiguration.vsTestVersion !== '17.0')
} else if ((testConfiguration.vsTestVersion !== '18.0')
&& (testConfiguration.vsTestVersion !== '17.0')
&& (testConfiguration.vsTestVersion !== '16.0')
&& (testConfiguration.vsTestVersion !== '15.0')
&& (testConfiguration.vsTestVersion !== '14.0')
Expand Down
18 changes: 16 additions & 2 deletions Tasks/VsTestV2/versionfinder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -91,12 +91,18 @@ function locateTestWindow(testConfig: models.TestConfigurations): string {
// latest
tl.debug('Searching for latest Visual Studio');

let vstestconsolePath = getVSTestConsolePath('17.0', '18.0');
let vstestconsolePath = getVSTestConsolePath('18.0', '19.0');
if (vstestconsolePath) {
testConfig.vsTestVersion = "18.0";
return path.join(vstestconsolePath, 'Common7', 'IDE', 'Extensions', 'TestPlatform');
}
vstestconsolePath = getVSTestConsolePath('17.0', '18.0');
if (vstestconsolePath) {
testConfig.vsTestVersion = "17.0";
return path.join(vstestconsolePath, 'Common7', 'IDE', 'Extensions', 'TestPlatform');
}
vstestconsolePath = getVSTestConsolePath('16.0', '17.0');

vstestconsolePath = getVSTestConsolePath('16.0', '17.0');
if (vstestconsolePath) {
testConfig.vsTestVersion = "16.0";
return path.join(vstestconsolePath, 'Common7', 'IDE', 'Extensions', 'TestPlatform');
Expand All @@ -117,6 +123,14 @@ function locateTestWindow(testConfig: models.TestConfigurations): string {

const vsVersion: number = parseFloat(testConfig.vsTestVersion);

if (vsVersion === 18.0) { //Visual Studio 2026
const vstestconsolePath = getVSTestConsolePath('18.0', '19.0');
if (vstestconsolePath) {
return path.join(vstestconsolePath, 'Common7', 'IDE', 'Extensions', 'TestPlatform');
}
throw (new Error(tl.loc('VstestNotFound', utils.Helper.getVSVersion(vsVersion))));
}

if (vsVersion === 17.0) { //Visual Studio 2022
const vstestconsolePath = getVSTestConsolePath('17.0', '18.0');
if (vstestconsolePath) {
Expand Down
22 changes: 19 additions & 3 deletions Tasks/VsTestV3/inputparser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,8 @@ function getTestPlatformSettings(inputDataContract : idc.InputDataContract) : id

ci.publishEvent({ subFeature: 'ToolsInstallerInstallationSuccessful' });

} else if ((vsTestVersion !== '17.0')
} else if ((vsTestVersion !== '18.0')
&& (vsTestVersion !== '17.0')
&& (vsTestVersion !== '16.0')
&& (vsTestVersion !== '15.0')
&& (vsTestVersion !== '14.0')
Expand Down Expand Up @@ -533,11 +534,18 @@ function getTestPlatformPath(inputDataContract : idc.InputDataContract) {

if (vsTestVersion.toLowerCase() === 'latest') {
tl.debug('Searching for latest Visual Studio.');
let vstestconsolePath = getVSTestConsolePath('17.0', '18.0');

let vstestconsolePath = getVSTestConsolePath('18.0', '19.0');
if (vstestconsolePath) {
return path.join(vstestconsolePath, 'Common7', 'IDE', 'Extensions', 'TestPlatform');
}
vstestconsolePath = getVSTestConsolePath('16.0', '17.0');

vstestconsolePath = getVSTestConsolePath('17.0', '18.0');
if (vstestconsolePath) {
return path.join(vstestconsolePath, 'Common7', 'IDE', 'Extensions', 'TestPlatform');
}

vstestconsolePath = getVSTestConsolePath('16.0', '17.0');
if (vstestconsolePath) {
return path.join(vstestconsolePath, 'Common7', 'IDE', 'Extensions', 'TestPlatform');
}
Expand All @@ -555,6 +563,14 @@ function getTestPlatformPath(inputDataContract : idc.InputDataContract) {

const vsVersion: number = parseFloat(vsTestVersion);

if (vsVersion === 18.0) {
const vstestconsolePath = getVSTestConsolePath('18.0', '19.0');
if (vstestconsolePath) {
return path.join(vstestconsolePath, 'Common7', 'IDE', 'Extensions', 'TestPlatform');
}
throw (new Error(tl.loc('VstestNotFound', utils.Helper.getVSVersion(vsVersion))));
}

if (vsVersion === 17.0) {
const vstestconsolePath = getVSTestConsolePath('17.0', '18.0');
if (vstestconsolePath) {
Expand Down
Loading