Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to upgrade MSbuild version in Azure pipeline?

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?

like image 341
Thiyagu Avatar asked Oct 21 '25 04:10

Thiyagu


2 Answers

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

like image 54
Ryan Lutz Avatar answered Oct 23 '25 20:10

Ryan Lutz


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:

enter image description here

like image 36
Leo Liu-MSFT Avatar answered Oct 23 '25 21:10

Leo Liu-MSFT