'Does Azure Pipeline Support .NET Core 3.1.7?

This is the error I get:

Agent job

This is my configuration:

MSBuild Config

Can anyone help me?



Solution 1:[1]

I fix that for the latest .NET release. The issue can be fixed with this line of code in your pipeline (.yaml) file.

steps:
- task: UseDotNet@2
  displayName: 'Use .NET Core sdk 6.0.x'
  inputs:
    version: 6.x
    includePreviewVersions: true

Just add the above step to your YAML file.

Solution 2:[2]

When you set the .NET Core SDK version to 3.x, it automatically download and install the latest in major version SDK 3.1.401, but SDK 3.1.401 is included in Visual Studio 16.7.1. Since the hosted agent installed Visual Studio 16.6.30320.27, which doesn't include SDK 3.1.401, you would get the error during the build.

Currently, you could set the .NET Core SDK version to 3.1.302, or 3.1.107, which should solve your issue.

https://dotnet.microsoft.com/download/dotnet-core/3.1

This issue has been reported to product team in the following case, you can follow the case to track the status:

https://developercommunity.visualstudio.com/content/problem/1145815/net-coremsbuild-tooling-not-finding-right-version.html

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 HootanHT
Solution 2 Cece Dong - MSFT