Thiyagu
Thiyagu

Reputation: 133

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?

Upvotes: 4

Views: 10389

Answers (3)

ΩmegaMan
ΩmegaMan

Reputation: 31576

Make sure your Agent Specification is set to the latest image of windows.

enter image description here

Upvotes: 1

Ryan Lutz
Ryan Lutz

Reputation: 525

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

Upvotes: 4

Leo Liu
Leo Liu

Reputation: 76660

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

Upvotes: 1

Related Questions