azure-pipelines-agent: [warning]Unable to find MSBuild version '14.0' for architecture 'x86'. Falling back to version '4.0'.

I get following output when I try to build with Visual Studio 2022 using build agent version 1.151.2 We are using Azure DevOps Server Version Dev17.M153.5 and have configure the build task to use the latest version of Visual Studio.

##[command]"C:\agent\_work\_tasks\VSBuild_71a9a2d3-a98a-4caa-96ab-affca411ecda\1.151.2\ps_modules\MSBuildHelpers\vswhere.exe" -version [16.0,17.0) -latest -format json
##[command]"C:\agent\_work\_tasks\VSBuild_71a9a2d3-a98a-4caa-96ab-affca411ecda\1.151.2\ps_modules\MSBuildHelpers\vswhere.exe" -version [16.0,17.0) -products Microsoft.VisualStudio.Product.BuildTools -latest -format json
##[command]"C:\agent\_work\_tasks\VSBuild_71a9a2d3-a98a-4caa-96ab-affca411ecda\1.151.2\ps_modules\MSBuildHelpers\vswhere.exe" -version [15.0,16.0) -latest -format json
##[command]"C:\agent\_work\_tasks\VSBuild_71a9a2d3-a98a-4caa-96ab-affca411ecda\1.151.2\ps_modules\MSBuildHelpers\vswhere.exe" -version [15.0,16.0) -products Microsoft.VisualStudio.Product.BuildTools -latest -format json

##[warning]Visual Studio was not found. Try installing a supported version of Visual Studio. See the task definition for a list of supported versions.
##[warning]Unable to find MSBuild version '14.0' for architecture 'x86'. Falling back to version '4.0'.

##[command]"C:\Windows\Microsoft.NET\Framework\v4.0.30319\msbuild.exe" "C:\agent\_work\3\s\Source\Foo.sln" /nologo /nr:false /fl /flp:"logfile=C:\agent\_work\3\s\Source\Foo.sln.log;verbosity=normal" /dl:CentralLogger,"C:\agent\_work\_tasks\VSBuild_71a9a2d3-a98a-4caa-96ab-affca411ecda\1.151.2\ps_modules\MSBuildHelpers\Microsoft.TeamFoundation.DistributedTask.MSBuild.Logger.dll";"RootDetailId=7eb43cc4-0a11-42ea-9084-1d5e577161b2|SolutionDir=C:\agent\_work\3\s\Source"*ForwardingLogger,"C:\agent\_work\_tasks\VSBuild_71a9a2d3-a98a-4caa-96ab-affca411ecda\1.151.2\ps_modules\MSBuildHelpers\Microsoft.TeamFoundation.DistributedTask.MSBuild.Logger.dll" /p:PlatformToolset=v142 /p:MyBinaryOutputPath=C:\agent\_work\3\b /p:TreatWChar_tAsBuiltInType=true /p:ConformanceMode=true /p:platform="x64" /p:configuration="ReleaseU" /p:_MSDeployUserAgent="TFS_0ab9ca53-8fd2-4470-8e40-506d7bd28f2d_build_4_0"
Building the projects in this solution one at a time. To enable parallel build, please add the "/m" switch.
Build started 2021-11-08 23:56:24.
Project "C:\agent\_work\3\s\Source\Foo.sln" on node 1 (default targets).

The build fail, how should I do to make it works?

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Comments: 24 (1 by maintainers)

Most upvoted comments

Azure DevOps Server is not released often, so all new changes came there with big delay. And as far as I know patches for existing versions of Azure DevOps Server usually contains fixes for the issues and not new features.

I don’t have info about future release of Azure DevOps Server, so I can’t say when VS 2022 will be available there.

Further expanded my temporary solution for this problem for now and hopefully for future situations with a similar issue. The project provides pre-built versions of the tasks as well as patched versions of the tasks that can be installed side-by-side the original tasks to prevent any breaking changes.

Download the task from the latest release and install them into you collection.

Alternatively install the tasks through an extension:

Required agent version

You will need to install a recent agent (2.195.0 or newer) from the azure-pipelines-agent repository for it to auto-detect Visual Studio 2022, or alternatively add the capabilities to the agent manually.

You may need to force Azure DevOps Server to not downgrade back to its preferred agent version. You can do so by setting the following environment variable at the system level on your server before launching the agent:

AZP_AGENT_DOWNGRADE_DISABLED=true

I don’t have information about future releases of Azure DevOps Server and when they will be released. But official release update is the only fully supported way for task update.

Manual update of the tasks is a possible solution without very high risks and I can provide you zip archives with latest released versions of these tasks and instruction how to update it manually. But again this solution is not fully supported and official.

Azure pipeline agent v2.195.0 released a few days ago now fixes detecting capabilities for VS2022 on my self-hosted agents.