I have an angular UI and API build which builds fine in local (Visual studio 2019). But in Azure pipeline it fails with below error.
Error : Version 5.0.407 of the .NET Core SDK requires at least version 16.8.0 of MSBuild. The current available version of MSBuild is 15.9.21.664. Change the .NET Core SDK specified in global.json to an older version that requires the MSBuild version currently available.
Where in Azure ADO Pipelines can the build version be specified?
You can consider adding this task in your pipeline:
UseDotNet@2
This pipeline task should update the .net version and, at the same time, update your version of MSBuild within the context of your build.
This is a basic example:
- task: UseDotNet@2
displayName: 'Install .NET Core SDK'
inputs:
packageType: sdk
version: 6.0.x
includePreviewVersions: false
https://learn.microsoft.com/en-us/azure/devops/pipelines/tasks/reference/use-dotnet-v2?view=azure-pipelines
How to upgrade MSbuild version in Azure pipeline?
You need to update your Visual Studio version from 2017 to 2019.
.NET Core SDK versions 5.0.XXX are intended to be used with Visual Studio 2019 and MSBuild 16.x.
.NET Core SDK versions for Visual Studio 2017 are 2.2.1XX and 2.1.5XX.
You could check the document Visual Studio SDKs:

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With