Skip to content

[BUG]: VSBuild seems to ignore the output of vswhere #21463

@andyfisher100

Description

@andyfisher100

New issue checklist

Task name

VSBuild

Task version

1.260.0

Issue Description

We have 2 build VMs that are a clone of each other. One fails to build whilst the other works. I noticed the following difference in the logs when building the same project. These machines has VS15, 19 and 22 installed

- task: VSBuild@1
    name: ''
    displayName: Build solution DependencyReader.sln
    inputs:
      solution: Build/$(branch.folder)/path/to/my/build.sln
      vsVersion: "16.0"
      platform: x64
      configuration: Release
      clean: true
      maximumCpuCount: true
      restoreNugetPackages: true

Broken Machine (selects vs22 when vs19 was specified in the task)

"D:\BuildAgent01\_work\_tasks\VSBuild_71a9a2d3-a98a-4caa-96ab-affca411ecda\1.260.0\node_modules\azure-pipelines-tasks-msbuildhelpers\tools\vswhere.exe" -version [16.0,17.0) -latest -format json
##[warning]The 'Restore NuGet Packages' option is deprecated. To restore NuGet packages in your build, add a NuGet Tool Installer task to your build definition.
"D:\BuildAgent01\externals\nuget\NuGet.exe" restore "D:\BuildAgent01\_work\3\s\path\to\my\build.sln" -NonInteractive
MSBuild auto-detection: using msbuild version '17.14.14.31908' from 'C:\Program Files\Microsoft Visual Studio\2022\Enterprise\MSBuild\Current\bin'.

Working machine (selects vs2015 when vs19 was specified in the task)

"D:\Agent01\_work\_tasks\VSBuild_71a9a2d3-a98a-4caa-96ab-affca411ecda\1.260.0\node_modules\azure-pipelines-tasks-msbuildhelpers\tools\vswhere.exe" -version [16.0,17.0) -latest -format json
##[warning]The 'Restore NuGet Packages' option is deprecated. To restore NuGet packages in your build, add a NuGet Tool Installer task to your build definition.
"D:\Agent01\externals\nuget\NuGet.exe" restore "D:\Agent01\_work\41\s\Build\s\path\to\my\build.sln" -NonInteractive
MSBuild auto-detection: using msbuild version '14.0' from 'C:\Program Files (x86)\MSBuild\14.0\bin'.

However when I run the same vswhere command manually, both machines provide the same output

D:\BuildAgent01\_work\_tasks\VSBuild_71a9a2d3-a98a-4caa-96ab-affca411ecda\1.260.0\node_modules\azure-pipelines-tasks-msbuildhelpers\tools>vswhere.exe -version [16.0,17.0) -latest -format json
[
  {
    "instanceId": "25dfd2bb",
    "installDate": "2021-04-30T14:12:16Z",
    "installationName": "VisualStudio/16.11.49+36227.6",
    "installationPath": "C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Enterprise",
    "installationVersion": "16.11.36227.6",
    "displayName": "Visual Studio Enterprise 2019",
    "description": "Scalable, end-to-end solution for teams of any size",
    "updateDate": "2025-07-14T09:49:08.3593848Z",
    "enginePath": "C:\\Program Files (x86)\\Microsoft Visual Studio\\Installer\\resources\\app\\ServiceHub\\Services\\Microsoft.VisualStudio.Setup.Service",
    "resolvedInstallationPath": "C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Enterprise",
    "channelId": "VisualStudio.16.Release",
    "installedChannelId": "VisualStudio.16.Release",
    "channelUri": "https://aka.ms/vs/16/release/channel",
    "installedChannelUri": "https://aka.ms/vs/16/release/channel",
    "releaseNotes": "https://docs.microsoft.com/en-us/visualstudio/releases/2019/release-notes-v16.11#16.11.49",
    "thirdPartyNotices": "https://go.microsoft.com/fwlink/?LinkId=660909"
  }
]

Environment type (Please select at least one enviroment where you face this issue)

  • Self-Hosted
  • Microsoft Hosted
  • VMSS Pool
  • Container

Azure DevOps Server type

dev.azure.com (formerly visualstudio.com)

Azure DevOps Server Version (if applicable)

No response

Operation system

Windows Server 2019

Relevant log output

See main bug description

Full task logs with system.debug enabled

No response

Repro steps

On a machine with multiple versions of visual studio installed

- task: VSBuild@1
    name: ''
    displayName: Build solution DependencyReader.sln
    inputs:
      solution: Build/$(branch.folder)/my/build.sln
      vsVersion: "16.0"
      platform: x64
      configuration: Release
      clean: true
      maximumCpuCount: true
      restoreNugetPackages: true

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