Skip to content

[enhancement]: Add support for MSBuild 18 to MSBuild@1 #21505

@philipp-naused

Description

@philipp-naused

Task name

MSBuild@1

Describe your feature request here

MSBuild@1 cannot find MSBuild 18. Please add it to the list of versions.

We have a self-hosted build agent with Visual Studio 2026 Build Tools.
But the MSBuild@1 task cannot find it.

using msbuildVersion: '18.0' the task fails with:
Cannot validate argument on parameter 'MajorVersion'. The argument "18" does not belong to the set "15,16,17" specified by the ValidateSet attribute. Supply an argument that is in the set and then try the command again.

using msbuildVersion: latest will just search all the versions that it knowns:

"F:\ws\_tasks\MSBuild_c6c4c611-aa2e-4a33-b606-5eaba2196824\1.260.0\node_modules\azure-pipelines-tasks-msbuildhelpers\tools\vswhere.exe" -version [17.0,18.0) -latest -format json
"F:\ws\_tasks\MSBuild_c6c4c611-aa2e-4a33-b606-5eaba2196824\1.260.0\node_modules\azure-pipelines-tasks-msbuildhelpers\tools\vswhere.exe" -version [17.0,18.0) -products Microsoft.VisualStudio.Product.BuildTools -latest -format json
"F:\ws\_tasks\MSBuild_c6c4c611-aa2e-4a33-b606-5eaba2196824\1.260.0\node_modules\azure-pipelines-tasks-msbuildhelpers\tools\vswhere.exe" -version [16.0,17.0) -latest -format json
"F:\ws\_tasks\MSBuild_c6c4c611-aa2e-4a33-b606-5eaba2196824\1.260.0\node_modules\azure-pipelines-tasks-msbuildhelpers\tools\vswhere.exe" -version [16.0,17.0) -products Microsoft.VisualStudio.Product.BuildTools -latest -format json
"F:\ws\_tasks\MSBuild_c6c4c611-aa2e-4a33-b606-5eaba2196824\1.260.0\node_modules\azure-pipelines-tasks-msbuildhelpers\tools\vswhere.exe" -version [15.0,16.0) -latest -format json
"F:\ws\_tasks\MSBuild_c6c4c611-aa2e-4a33-b606-5eaba2196824\1.260.0\node_modules\azure-pipelines-tasks-msbuildhelpers\tools\vswhere.exe" -version [15.0,16.0) -products Microsoft.VisualStudio.Product.BuildTools -latest -format json

(in this case it will fall back to C:\Program Files (x86)\MSBuild\12.0\bin\msbuild.exe)

We have to hard-code the path via msbuildLocation to work around this.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions