Skip to content

Commit 7d3243a

Browse files
authored
Add MSBuild V18 support to MSBuildV1 and VSBuildV1 (#21476)
* Update MSBuildV1 task to support selecting MSBuild V18 * Update NuGetCommandV2 task to support MSBuild V18 * Regenerate package-lock.json to resolve inconsistent builds * Add support for Visual Studio 2026 (MSBuild V18) in VSBuildV1 task * Revert "Regenerate package-lock.json to resolve inconsistent builds" This reverts commit d914ad5. * Revert "Update NuGetCommandV2 task to support MSBuild V18" This reverts commit 30bd04d. * Update MSBuild task version to 1.267.0 and update package dependencies * Update VSBuild task to version 1.267.0 and update package dependencies * Add tests for Visual Studio version 18 support in VSBuild task
1 parent b165242 commit 7d3243a

24 files changed

+172
-69
lines changed

Tasks/MSBuildV1/package-lock.json

Lines changed: 77 additions & 35 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Tasks/MSBuildV1/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
"@types/mocha": "^9.1.1",
2020
"@types/node": "^20.3.1",
2121
"azure-pipelines-task-lib": "^4.16.0",
22-
"azure-pipelines-tasks-msbuildhelpers": "3.259.1"
22+
"azure-pipelines-tasks-msbuildhelpers": "3.266.0"
2323
},
2424
"devDependencies": {
2525
"typescript": "5.1.6"

Tasks/MSBuildV1/task.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
"author": "Microsoft Corporation",
1313
"version": {
1414
"Major": 1,
15-
"Minor": 260,
15+
"Minor": 267,
1616
"Patch": 0
1717
},
1818
"demands": [
@@ -56,6 +56,7 @@
5656
"visibleRule": "msbuildLocationMethod = version",
5757
"options": {
5858
"latest": "Latest",
59+
"18.0": "MSBuild 18.0",
5960
"17.0": "MSBuild 17.0",
6061
"16.0": "MSBuild 16.0",
6162
"15.0": "MSBuild 15.0",

Tasks/MSBuildV1/task.loc.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
"author": "Microsoft Corporation",
1313
"version": {
1414
"Major": 1,
15-
"Minor": 260,
15+
"Minor": 267,
1616
"Patch": 0
1717
},
1818
"demands": [
@@ -56,6 +56,7 @@
5656
"visibleRule": "msbuildLocationMethod = version",
5757
"options": {
5858
"latest": "Latest",
59+
"18.0": "MSBuild 18.0",
5960
"17.0": "MSBuild 17.0",
6061
"16.0": "MSBuild 16.0",
6162
"15.0": "MSBuild 15.0",

Tasks/VSBuildV1/Get-VSPath.ps1

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,12 @@ function Get-VSPath {
44
[Parameter(Mandatory = $true)]
55
[string]$Version)
66

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

1010
try {
1111
if ( !($Version -in $Versions )) {
12-
Write-Warning "Please enter one of the versions 10.0, 11.0, 12.0, 14.0, 15.0, 16.0, 17.0"
12+
Write-Warning "Please enter one of the versions 10.0, 11.0, 12.0, 14.0, 15.0, 16.0, 17.0, 18.0"
1313
} else {
1414
$VersionNumber = [int]$Version.Remove(2)
1515
# Search for more than 15.0 Willow instance.

Tasks/VSBuildV1/Select-VSVersion.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ function Select-VSVersion {
55
Trace-VstsEnteringInvocation $MyInvocation
66
try {
77
$specificVersion = $PreferredVersion -and $PreferredVersion -ne 'latest'
8-
$versions = '17.0', '16.0', '15.0', '14.0', '12.0', '11.0', '10.0' | Where-Object { $_ -ne $PreferredVersion }
8+
$versions = '18.0', '17.0', '16.0', '15.0', '14.0', '12.0', '11.0', '10.0' | Where-Object { $_ -ne $PreferredVersion }
99

1010
# Look for a specific version of Visual Studio.
1111
if ($specificVersion) {

Tasks/VSBuildV1/Tests/L0.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,9 @@ describe('VSBuild Suite', function () {
3939
it('(Select-VSVersion) falls back from 17', (done) => {
4040
psr.run(path.join(__dirname, 'Select-VSVersion.FallsBackFrom17.ps1'), done);
4141
})
42+
it('(Select-VSVersion) falls back from 18', (done) => {
43+
psr.run(path.join(__dirname, 'Select-VSVersion.FallsBackFrom18.ps1'), done);
44+
})
4245
it('(Select-VSVersion) falls forward from 12', (done) => {
4346
psr.run(path.join(__dirname, 'Select-VSVersion.FallsForwardFrom12.ps1'), done);
4447
})
@@ -51,6 +54,12 @@ describe('VSBuild Suite', function () {
5154
it('(Select-VSVersion) falls forward from 16', (done) => {
5255
psr.run(path.join(__dirname, 'Select-VSVersion.FallsForwardFrom16.ps1'), done);
5356
})
57+
it('(Select-VSVersion) falls forward from 17', (done) => {
58+
psr.run(path.join(__dirname, 'Select-VSVersion.FallsForwardFrom17.ps1'), done);
59+
})
60+
it('(Select-VSVersion) finds 18', (done) => {
61+
psr.run(path.join(__dirname, 'Select-VSVersion.Finds18.ps1'), done);
62+
})
5463
it('(Select-VSVersion) finds latest', (done) => {
5564
psr.run(path.join(__dirname, 'Select-VSVersion.FindsLatest.ps1'), done);
5665
})

Tasks/VSBuildV1/Tests/MapsVSVersions.ps1

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ Register-Mock Invoke-BuildTools
1010
Register-Mock EmitTelemetry
1111
$mappings = @(
1212
@{ VSVersion = '' ; MSBuildVersion = '14.0' }
13+
@{ VSVersion = '18.0' ; MSBuildVersion = '18.0' }
1314
@{ VSVersion = '17.0' ; MSBuildVersion = '17.0' }
1415
@{ VSVersion = '16.0' ; MSBuildVersion = '16.0' }
1516
@{ VSVersion = '15.0' ; MSBuildVersion = '15.0' }

Tasks/VSBuildV1/Tests/Select-VSVersion.FallsBackFrom14.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,5 +12,5 @@ $actual = Select-VSVersion -PreferredVersion '14.0'
1212

1313
# Assert.
1414
Assert-WasCalled Write-Warning
15-
Assert-WasCalled Get-VSPath -Times 5
15+
Assert-WasCalled Get-VSPath -Times 6
1616
Assert-AreEqual -Expected '12.0' -Actual $actual

Tasks/VSBuildV1/Tests/Select-VSVersion.FallsBackFrom15.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,5 +12,5 @@ $actual = Select-VSVersion -PreferredVersion '15.0'
1212

1313
# Assert.
1414
Assert-WasCalled Write-Warning
15-
Assert-WasCalled Get-VSPath -Times 4
15+
Assert-WasCalled Get-VSPath -Times 5
1616
Assert-AreEqual -Expected '14.0' -Actual $actual

0 commit comments

Comments
 (0)