Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to migrate Azure Functions v3 to .net core 5.0

I have upgraded all assemblies in an Azure Function v3 project to version 5.0 but I am unable to run the function. Here it is my function's csproj file's partial definition:

<PropertyGroup>
    <TargetFramework>netcoreapp3.1</TargetFramework>
    <AzureFunctionsVersion>v3</AzureFunctionsVersion>
  </PropertyGroup>
  <ItemGroup>
    <PackageReference Include="Microsoft.Azure.Functions.Extensions" Version="1.1.0" />
    <PackageReference Include="Microsoft.Azure.WebJobs.Extensions.Storage" Version="4.0.3" />
    <PackageReference Include="Microsoft.NET.Sdk.Functions" Version="3.0.11" />
    <PackageReference Include="Microsoft.Azure.WebJobs.Extensions.SignalRService" Version="1.2.2" />
    <PackageReference Include="System.Net.Http" Version="4.3.4" />
  </ItemGroup>

What's the necessary workaround to make this function with .NET 5? Google did not yield anything conclusive.

Further info: 5.0.100 [C:\Program Files\dotnet\sdk]

This is one of the error messages that I get:

Could not load file or assembly 'Microsoft.Extensions.Configuration.Abstractions, Version=5.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60'. The system cannot find the file specified.

like image 584
Arash Avatar asked Nov 15 '20 01:11

Arash


People also ask

Do Azure functions support .NET 5?

NET 5 Azure Functions. You'll need . NET 5.0 installed and Visual Studio 2019 (version 16.10 or later) with the Azure development workloads also installed to be able to create . NET 5 Azure Functions.

Do Azure functions support .NET framework?

NET Framework and only supports development in the Azure portal, Azure Stack Hub portal, or locally on Windows computers. This version is in maintenance mode, with enhancements provided only in later versions. Beginning on December 3, 2022, function apps running on versions 2.


2 Answers

Azure functions team released support for .Net 5 by introducing a new isolated process model to run .NET function apps.

You can read more about this in the announcement.

To migrate you function app to .Net 5 you can follow this guide.

like image 83
Ramūnas Avatar answered Oct 22 '22 10:10

Ramūnas


Dave Brock created a web page explaining the process using the preview bits. But I believe it should be close enough for the release bits. See here.

Looks like Brandon Minnick's guide is more comprehensive. See here.

like image 44
laorient Avatar answered Oct 22 '22 09:10

laorient