Fix .NET 5 Azure Functions Build Error on Azure DevOps
more_vert
Context
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).
Resolution
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' inputs: packageType: sdk version: '3.1.x' - task: UseDotNet50 displayName: 'Use .NET 5 SDK' inputs: packageType: sdk version: '5.0.x'
info Last modified by Raymond 2 years ago
copyright
This page is subject to Site terms.
comment Comments
No comments yet.
Log in with external accounts
warning Please login first to view stats information.
article
Create Blob Triggered Azure Functions using .NET 5
article
Azure Functions: Timeout value of 00:05:00 exceeded by function
article
Use Entity Framework in .NET 5 Azure Functions
article
Azure DevOps - Configure Web or Function App Settings
article
Read Environment Variables in .NET Azure Functions
Read more (16)