How to migrate Azure Functions v3 to .net core 5.0
Asked Answered
Y

3

13

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.

Yuu answered 15/11, 2020 at 1:14 Comment(4)
Functions don't support .NET 5 yet, they estimate this to be ready end of this year. See this GitHub comment: github.com/Azure/azure-functions-host/issues/…Markson
It supports .NET Core 5 as of yesterday. It has been in preview mode for awhile, but it is now GA.Cyclo
Now that support for .Net Core 5 is live, could you update your accepted answer. The bottom one contains links with a lot of great stuff.Thesaurus
I am getting same error, is it resolved?Potvaliant
S
11

The comment by @Marc is correct, currently Azure Functions do not support .net 5. Current ETA is a preview by end of year.

Please keep an eye on this github issue for any updates.

Sheen answered 16/11, 2020 at 6:8 Comment(2)
Okay so in this case should we downgrade and use 3.0 on linux?Sankey
It's live as of yesterday.Cyclo
A
12

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.

Alessandro answered 12/3, 2021 at 8:10 Comment(1)
Although that link does go to some of the best info out there on Azure Functions 5, it isn't a migration guide. Would love it if you could link to one.Cyclo
S
11

The comment by @Marc is correct, currently Azure Functions do not support .net 5. Current ETA is a preview by end of year.

Please keep an eye on this github issue for any updates.

Sheen answered 16/11, 2020 at 6:8 Comment(2)
Okay so in this case should we downgrade and use 3.0 on linux?Sankey
It's live as of yesterday.Cyclo
T
3

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.

Tatyanatau answered 15/4, 2021 at 4:8 Comment(2)
Why do people keep linking guides for "creating" when the desire is to migrate existing code.Kernite
Looks to me that both linking guides do contain a lot of interesting things about migrating.Thesaurus

© 2022 - 2024 — McMap. All rights reserved.