Raymond Raymond

Fix .NET 5 Azure Functions Build Error on Azure DevOps

event 2021-08-21 visibility 1,608 comment 0 insights toc
insights Stats
toc Table of contents
Fix .NET 5 Azure Functions Build Error on Azure DevOps


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

##[error]C:\Users\VssAdministrator\.nuget\packages\microsoft.net.sdk.functions\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:
  - https://aka.ms/dotnet-core-applaunch?framework=Microsoft.NETCore.App&framework_version=3.1.0&arch=x64&rid=win10-x64	

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
comment Comments
No comments yet.

Please log in or register to comment.

account_circle Log in person_add Register

Log in with external accounts