DEV Community

Kenichiro Nakamura
Kenichiro Nakamura

Posted on

1 1

Build .NET 5 Azure Functions with Azure DevOps pipeline

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'
Enter fullscreen mode Exit fullscreen mode

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

Postmark Image

Speedy emails, satisfied customers

Are delayed transactional emails costing you user satisfaction? Postmark delivers your emails almost instantly, keeping your customers happy and connected.

Sign up

Top comments (0)

A Workflow Copilot. Tailored to You.

Pieces.app image

Our desktop app, with its intelligent copilot, streamlines coding by generating snippets, extracting code from screenshots, and accelerating problem-solving.

Read the docs