Kenichiro Nakamura
Posted on April 6, 2021
I believe most of us already migrate our Azure Functions from older .NET version to .NET 5!! And most of us uses Azure DevOps to build them, am I right?
I encounter an issue when I build the function app so I like to share it so that others won't suffer from the issue.
Issue
When using Azure DevOps pipeline to build Azure Function with .NET 5, I encountered following error.
[error]/home/vsts/.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.
Cause
The root cause is that I need both .NET Core 3 and .NET 5 to successfully build the application. Therefore, I simply need to add UseDotNet task twice with different versions!
- task: UseDotNet@2
displayName: 'Use .NET Core 3.1 sdk'
inputs:
packageType: sdk
version: '3.1.x'
- task: UseDotNet@2
displayName: 'Use .NET 5 sdk'
inputs:
packageType: sdk
version: '5.0.x'
I hope we can build the app only with .NET 5 SDK in the near future, as this was a bit confusing :)
Reference
Stackoverflow:.NET 5 - The framework 'Microsoft.NETCore.App', version '3.1.0' was not found
Posted on April 6, 2021
Join Our Newsletter. No Spam, Only the good stuff.
Sign up to receive the latest update from our blog.