Fix .NET 5 Azure Functions Build Error on Azure DevOps

Raymond Raymond visibility 1,402 event 2021-08-21 access_time 3 years ago language English


When building .NET 5 Azure functions on Azure DevOps, you may encounter the following error:

##[error]C:\Users\VssAdministrator\.nuget\packages\\3.0.11\build\Microsoft.NET.Sdk.Functions.Build.targets(32,5): Error : It was not possible to find any compatible framework version
The framework 'Microsoft.NETCore.App', version '3.1.0' was not found.
  - The following frameworks were found:
      5.0.0 at [C:\hostedtoolcache\windows\dotnet\shared\Microsoft.NETCore.App]
5.0.0 at [C:\hostedtoolcache\windows\dotnet\shared\Microsoft.NETCore.App]
You can resolve the problem by installing the specified framework and/or SDK.

The specified framework can be found at:

This error will occur if you only use .NET 5 SDK while unfortunately for .NET 5 Azure Functions, it still requires .NET 3.1.x to build some of the dependent packages. This will probably be resolved in .NET 6 (with Azure function 4.x).


The build logs already provide the solution: we just need to add .NET Core 3.1 SDK into build context.

In classic view, you need to add two tasks: one is to install .NET 5 SDK and another one for .NET Core 3.1 SDK.


If you use YAML, add the following two tasks:

- task: UseDotNet31
  displayName: 'Use .NET Core 3.1 SDK'
    packageType: sdk
    version: '3.1.x'

- task: UseDotNet50
  displayName: 'Use .NET 5 SDK'
    packageType: sdk
    version: '5.0.x'
More from Kontext
info Last modified by Raymond 3 years ago copyright This page is subject to Site terms.
Like this article?
Share on
comment Comments
No comments yet.

Please log in or register to comment.

account_circle Log in person_add Register

Log in with external accounts