Closed prabh-62 closed 3 years ago
Not sure, if this issue should be moved to https://github.com/Azure/azure-functions-vs-build-sdk repo
This is a very interesting question. Is there a roadmap for supporting .Net 5 in Azure Functions?
Is there a plan to support EF Core 5 on .Net Core 3.1?
@prabh-62 @Peter-B- Have you tried using azure functions prerelease as so:
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net5.0</TargetFramework>
<AzureFunctionsVersion>v3-prerelease</AzureFunctionsVersion>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.Azure.Functions.Extensions" Version="1.1.0" />
<PackageReference Include="Microsoft.Azure.WebJobs.Extensions.EventGrid" Version="2.1.0" />
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="5.0.0-rc.1.20451.13" />
<PackageReference Include="Microsoft.NET.Sdk.Functions" Version="3.0.9" />
</ItemGroup>
@c0dybrown Does it work as a workaround ?
@c0dybrown No, I didn't know about it. Thanks for bringing that to my attention. I will give it a try.
I know that it says prerelease, but is there any "getting started" or documentation for that? I could not find much on Google or even Bing :-)
I tried with v3-prerelease
. Still the same errors with dotnet build
command.
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net5.0</TargetFramework>
<AzureFunctionsVersion>v3-prerelease</AzureFunctionsVersion>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.NET.Sdk.Functions" Version="3.0.9" />
</ItemGroup>
</Project>
dotnet build
Microsoft (R) Build Engine version 16.8.0-preview-20451-02+51a1071f8 for .NET
Copyright (C) Microsoft Corporation. All rights reserved.
Determining projects to restore...
Restored /workspaces/net5fn/ImageService.csproj (in 534 ms).
You are using a preview version of .NET. See: https://aka.ms/dotnet-core-preview
ImageService -> /workspaces/net5fn/bin/Debug/net5.0/ImageService.dll
/root/.nuget/packages/microsoft.net.sdk.functions/3.0.9/build/Microsoft.NET.Sdk.Functions.Build.targets(32,5): error : It was not possible to find any compatible framework version [/workspaces/net5fn/ImageService.csproj]
/root/.nuget/packages/microsoft.net.sdk.functions/3.0.9/build/Microsoft.NET.Sdk.Functions.Build.targets(32,5): error : The framework 'Microsoft.NETCore.App', version '3.1.0' was not found. [/workspaces/net5fn/ImageService.csproj]
/root/.nuget/packages/microsoft.net.sdk.functions/3.0.9/build/Microsoft.NET.Sdk.Functions.Build.targets(32,5): error : - The following frameworks were found: [/workspaces/net5fn/ImageService.csproj]
/root/.nuget/packages/microsoft.net.sdk.functions/3.0.9/build/Microsoft.NET.Sdk.Functions.Build.targets(32,5): error : 5.0.0-rc.1.20451.14 at [/usr/share/dotnet/shared/Microsoft.NETCore.App] [/workspaces/net5fn/ImageService.csproj]
/root/.nuget/packages/microsoft.net.sdk.functions/3.0.9/build/Microsoft.NET.Sdk.Functions.Build.targets(32,5): error : [/workspaces/net5fn/ImageService.csproj]
/root/.nuget/packages/microsoft.net.sdk.functions/3.0.9/build/Microsoft.NET.Sdk.Functions.Build.targets(32,5): error : You can resolve the problem by installing the specified framework and/or SDK. [/workspaces/net5fn/ImageService.csproj]
/root/.nuget/packages/microsoft.net.sdk.functions/3.0.9/build/Microsoft.NET.Sdk.Functions.Build.targets(32,5): error : [/workspaces/net5fn/ImageService.csproj]
/root/.nuget/packages/microsoft.net.sdk.functions/3.0.9/build/Microsoft.NET.Sdk.Functions.Build.targets(32,5): error : The specified framework can be found at: [/workspaces/net5fn/ImageService.csproj]
/root/.nuget/packages/microsoft.net.sdk.functions/3.0.9/build/Microsoft.NET.Sdk.Functions.Build.targets(32,5): error : - https://aka.ms/dotnet-core-applaunch?framework=Microsoft.NETCore.App&framework_version=3.1.0&arch=x64&rid=debian.10-x64 [/workspaces/net5fn/ImageService.csproj]
/root/.nuget/packages/microsoft.net.sdk.functions/3.0.9/build/Microsoft.NET.Sdk.Functions.Build.targets(32,5): error : [/workspaces/net5fn/ImageService.csproj]
/root/.nuget/packages/microsoft.net.sdk.functions/3.0.9/build/Microsoft.NET.Sdk.Functions.Build.targets(32,5): error : Metadata generation failed. [/workspaces/net5fn/ImageService.csproj]
Build FAILED.
/root/.nuget/packages/microsoft.net.sdk.functions/3.0.9/build/Microsoft.NET.Sdk.Functions.Build.targets(32,5): error : It was not possible to find any compatible framework version [/workspaces/net5fn/ImageService.csproj] /root/.nuget/packages/microsoft.net.sdk.functions/3.0.9/build/Microsoft.NET.Sdk.Functions.Build.targets(32,5): error : The framework 'Microsoft.NETCore.App', version '3.1.0' was not found. [/workspaces/net5fn/ImageService.csproj] /root/.nuget/packages/microsoft.net.sdk.functions/3.0.9/build/Microsoft.NET.Sdk.Functions.Build.targets(32,5): error : - The following frameworks were found: [/workspaces/net5fn/ImageService.csproj] /root/.nuget/packages/microsoft.net.sdk.functions/3.0.9/build/Microsoft.NET.Sdk.Functions.Build.targets(32,5): error : 5.0.0-rc.1.20451.14 at [/usr/share/dotnet/shared/Microsoft.NETCore.App] [/workspaces/net5fn/ImageService.csproj] /root/.nuget/packages/microsoft.net.sdk.functions/3.0.9/build/Microsoft.NET.Sdk.Functions.Build.targets(32,5): error : [/workspaces/net5fn/ImageService.csproj] /root/.nuget/packages/microsoft.net.sdk.functions/3.0.9/build/Microsoft.NET.Sdk.Functions.Build.targets(32,5): error : You can resolve the problem by installing the specified framework and/or SDK. [/workspaces/net5fn/ImageService.csproj] /root/.nuget/packages/microsoft.net.sdk.functions/3.0.9/build/Microsoft.NET.Sdk.Functions.Build.targets(32,5): error : [/workspaces/net5fn/ImageService.csproj] /root/.nuget/packages/microsoft.net.sdk.functions/3.0.9/build/Microsoft.NET.Sdk.Functions.Build.targets(32,5): error : The specified framework can be found at: [/workspaces/net5fn/ImageService.csproj] /root/.nuget/packages/microsoft.net.sdk.functions/3.0.9/build/Microsoft.NET.Sdk.Functions.Build.targets(32,5): error : - https://aka.ms/dotnet-core-applaunch?framework=Microsoft.NETCore.App&framework_version=3.1.0&arch=x64&rid=debian.10-x64 [/workspaces/net5fn/ImageService.csproj] /root/.nuget/packages/microsoft.net.sdk.functions/3.0.9/build/Microsoft.NET.Sdk.Functions.Build.targets(32,5): error : [/workspaces/net5fn/ImageService.csproj] /root/.nuget/packages/microsoft.net.sdk.functions/3.0.9/build/Microsoft.NET.Sdk.Functions.Build.targets(32,5): error : Metadata generation failed. [/workspaces/net5fn/ImageService.csproj] 0 Warning(s) 2 Error(s)
Time Elapsed 00:00:02.54
https://github.com/Azure/azure-functions-vs-build-sdk/issues/451#issuecomment-693030505
As per this comment, .NET 5 is not supported
Does anyone know a plan for enabling EF Core 5 und .Net Core 3.1 in an Azure Function?
This would be great, but when I run it locally, it does not find Microsoft.Extensions.Logging 5.
See Azure/azure-functions-vs-build-sdk#472
Azure/azure-functions-vs-build-sdk#451 (comment)
As per this comment, .NET 5 is not supported
My question is, will Azure Functions have a new release in November when GA happens for .NET 5?
We’re working .NET 5 support but don’t know whether it will be ready when .NET 5 is GA.
As for running EF Core 5 on v3, we need to investigate why it’s not working.
.NET 5 publish to azure functions is working but there are a few "could not evaluate...' errors. It does deploy the zip file though, but every function call gets a 404 error.
Since azure functions lags months behind the general .net annual cycle, can we get self contained publishing support on azure functions? This has to make your life simpler on the back-end as you can stop caring about what runtimes are installed on your Windows and Linux cloud servers...
Currently, .NET functions compile to a class library that is loaded in a .NET Core 3.1 host process, so you can't run on .NET 5 by publishing a self-contained exe.
With the new .NET 5 worker, we're breaking from the class library model and the worker will be its own process.
cc @jeffhollan
Hi there, is there any news on that? Thanks, Tim
@anthonychu One thing that would bridge the gap in a big way: get EF Core 5 working on Azure functions somehow. For me and many others that I work with, the most critical feature coming out of the .NET/EF 5 release is the new "Split Query" feature. Using split queries for long include chains in EF cuts transaction time exponentially and drastically reduces code complexity.
It's the difference between having a function run for 45+ seconds (or fail) due to a poorly optimized DB query that requires developer intervention and a bunch of code to fix, and having the same code execute in <1 second.
Please my friend, I will personally put a bounty on EF 5 in Azure Functions
@c0dybrown have you tried using efcore5 with netcoreapp3.1? In the interim, I dont think EF core 5 requires .net5
@c0dybrown have you tried using efcore5 with netcoreapp3.1? In the interim, I dont think EF core 5 requires .net5
It works with netcore3.1 but it doesn't work with Azure Function v3, on Azure. If you want to "run/debug" locally you can update (4) Azure Functions Core Tools dlls to version 5 and it will work. But it will fail when you deploy it to Azure.
@c0dybrown have you tried using efcore5 with netcoreapp3.1? In the interim, I dont think EF core 5 requires .net5
It works with netcore3.1 but it doesn't work with Azure Function v3, on Azure. If you want to "run/debug" locally you can update (4) Azure Functions Core Tools dlls to version 5 and it will work. But it will fail when you deploy it to Azure.
@onionhammer - @thiagottss answer is accurate in my experience, even after trying a million "tricks" such as installing the .NET 5 runtime on the Azure function host
@thiagottss ahh that bites. Hopefully Microsoft fixes this swiftly :/
We are about to deploy our application with .Net 5 ... Just the Azure function does not support it... What's going wrong here?
Azure functions is getting overhauled - self contained deploys will be the future as far as I understand, then we don't have this annual mess of not being able to upgrade .net version.
It would be nice to get some sort of ETA; like "Coming December" or "Coming Q3 of 2024", just a ballpark to know if its worth waiting
If you need to deploy today, make a .net core 3.1 functions app and refactor any shared code that your functions project needs into a .net standard 2.1 library. Once they get their stuff in order, you can move the 3.1 functions app to .net 5.
This is a little painful but can be accomplished by adding linked .cs files to the .net standard 2.1 library project (or to the functions project and skip the library project). It's a little hacky, but only temporary until they get things sorted out.
This issue is blocking our upgrade to .NET 5 and we'd like to know if it's worth waiting a couple weeks for Azure Functions to support .NET 5 or if we should go ahead changing our libraries to netstandard2.1 and functions back to netcoreapp3.1
Current ETA is a preview by end of year. Thanks for your patience.
If you need to deploy today, make a .net core 3.1 functions app and refactor any shared code that your functions project needs into a .net standard 2.1 library. Once they get their stuff in order, you can move the 3.1 functions app to .net 5.
This is a little painful but can be accomplished by adding linked .cs files to the .net standard 2.1 library project (or to the functions project and skip the library project). It's a little hacky, but only temporary until they get things sorted out.
3rd party packages that teams rely on should also move to .net standard 2.1 right?
Definitely. If you are relying on Azure functions in the next few months, I'd rely on .net standard 2.1 to bridge the gap. Most nuget packages support it just fine.
It is blocking us to use .NET 5 too... will the next version support gRPC triggers and streams for functions? maybe you need some help to make it faster?
As a side note I recall that this same thing happened in the transition from dotnet core 2.2 to 3.0. We had to wait until the following January, after the 3.0 release, to upgrade to 3.0 as azure functions took a few months to catch up. I hope they stop this practice in the future as it is incredibly annoying to have to hold every thing just for them. Even if it is for the best to change how functions work they should realize a new major version is in the works and account for it. Oh well....
As a side note I recall that this same thing happened in the transition from dotnet core 2.2 to 3.0. We had to wait until the following January, after the 3.0 release, to upgrade to 3.0 as azure functions took a few months to catch up. I hope they stop this practice in the future as it is incredibly annoying to have to hold every thing just for them. Even if it is for the best to change how functions work they should realize a new major version is in the works and account for it. Oh well....
I've been assuming the changes that they have been making this year that broke their own code (such as not being able to use SqlClient with Azure Functions for a while) was because they were focused on .Net 5... that seems to not the case and that makes me a little worried.
Currently, .NET functions run inside the Azure Functions host. The host is something that runs in production for all of our customers (regardless of language) and we take upgrading it very seriously. This means when new versions of .NET is released, it’s more than just recompiling against the new framework and shipping it. We need to go through a preview process before we can declare GA.
This is also the reason why we are not updating the host to .NET 5. We’d need to support the host longer than .NET 5’s planned its end of life.
For .NET 5, we are building a completely new language worker that runs in a separate process from the host, like the workers for other languages. Because it’s built from the ground up, it’s taking longer to get ready.
The good news is that we believe the out-of-process model will allow us to do a better job of keeping up with future .NET releases, as it’s just a NuGet package now.
Thanks for your patience on this. We want to ship this as much as you all want to get your hands on it. 🙂
@anthonychu , understood, however what is the ETA? Nov, Dec, or Jan?
Any chance to get it earlier out for those like us hosting in AKS?
Need that for my own planning, if it is Jan I will see if I can dump the functions framework then and replace with standard .net core asp.net mvc stuff ... The only thing I am using are anyway only the event hub and queue triggers ...
I totally agree with @deyanp. I already moved some functions to our local server (.NET 5). Bc I don’t want to maintain two different frameworks.
@anthonychu , does this mean that the dependencies for our functions will decouple form the underlying host, but only if you are not running netcoreapp3.1?
Currently targeting public preview before end of December but can’t provide a definite date right now.
@deyanp If you are running in AKS and those are the only triggers you need, a good alternative is to use the WebJobs SDK directly in a .NET 5 console app.
You can also run .NET 5 in Functions as a custom handler. But our recommendation is to wait for the worker.
@AartBluestoke If you choose to use the new worker, you’ll be creating a .NET 5 app that references the .NET 5 worker NuGet package. That app should be able to reference .NET Core 3.1 and .NET standard assemblies. Because you are in control of the app and the app runs as a separate process, you shouldn’t have to worry about dependencies conflicting with those from the host.
@deyanp If you are running in AKS and those are the only triggers you need, a good alternative is to use the WebJobs SDK directly in a .NET 5 console app.
@anthonychu , sorry, I meant in addition to HttpTriggers ... any hints how to migrate away from Azure Functions to .net console app with webjobs sdk for queuetrigger/eventhubtrigger/timertrigger and still be able to serve http api calls (and even grpc which is anyway completely missing in azure functions)?
@anthonychu
Ran across this issue and found quite a few related one spread over Stack Overflow and GitHub. Guidance needs to be provided on the use of .NET 5 with Azure Functions V3.
IMO - It may be worthwhile to note this in the Azure Functions documentation. Specifically in https://docs.microsoft.com/en-us/azure/azure-functions/functions-dotnet-dependency-injection#register-services.
@anthonychu Thanks for the updates on this. Will the .NET 5 support be coming to WebJobs too? Functions still sits on top of a lot of the WebJobs libraries I believe?
I find it really surprising Net 5 would be released (EF Core as well) and Azure Functions wouldn't be released inline with that support. Seems like a team sync failure.
I know they are retooling azure functions to avoid this delay in future .net releases, so hopefully this is the last year for this sort of thing :)
We have the following package references in our functions project:
<PackageReference Include="Microsoft.Azure.Functions.Extensions" Version="[1.1.0]" />
<PackageReference Include="Microsoft.Azure.WebJobs.Extensions.Storage" Version="[4.0.3]" />
<PackageReference Include="Microsoft.Extensions.Http" Version="[3.1.9]" />
<PackageReference Include="Microsoft.Extensions.Http.Polly" Version="[3.1.9]" />
<PackageReference Include="Microsoft.NET.Sdk.Functions" Version="[3.0.11]" />
Is there anything wrong with upgrading Microsoft.Extensions.Http
and Microsoft.Extensions.Http.Polly
to 5.0.0
?
On a related note, it'd be neat to learn how I can figure out these types of compatibility checks on my own without trial and error.
@AnthonyIacono as i commented in Azure/azure-functions-host#6893
Consequence: if you need a library that is a direct or indirect dependency of azure functions you can only use the version that is loaded. This is a case where azure functions is incorrectly reporting its hard dependencies.
eg: if you are using azure functions 3.0.7, then you must use a library binary compatible with dependencyInjection.abstractions 2.1.0 When your code (eg if you have a asp.netcore dependencency) asks for something that is only found in Abstractions >=5.0 the runtime (correctly) responds "sorry, that function isn't there", because all it has is the 2.1.0 dll in memory.
(searching for the library name when you have azure functions as a dependency shows:)
Therefore the many tickets that will be raised that are like this can only be solved by upgrading azure functions to a newer version which has a dependency on the 5.x line of the abstractions.
In this particular case azure functions has no direct dependencies on Microsoft.Extensions.Http however they share transitive dependencies such as the logging abstractions:
In this particular case, if azure functions used Microsoft.Extensions.Logging.Abstractions 5.0, then it would be fine because that library appears to be backwards compatible so the reverse error doesn't occur (no runtime failure if you expect 2.1 and actually get 5.0).
If that is not true for all libraries in common between azure functions and the libraries your code uses, then you will be pinned in terms of your dependencies and azure functions versions.
@AartBluestoke Gotcha. I appreciate the detailed explanation. I'll put a pin in upgrading these packages for now and leave a comment in our CSPROJ. This is a total bummer since I have a somewhat "OCD" for always upgrading our packages.
Currently targeting public preview before end of December but can’t provide a definite date right now.
@deyanp If you are running in AKS and those are the only triggers you need, a good alternative is to use the WebJobs SDK directly in a .NET 5 console app.
You can also run .NET 5 in Functions as a custom handler. But our recommendation is to wait for the worker.
So I wait for the worker... any more precise ETA? Even close to precise? (deadline coming in fast) :)
This is such a bummer, and a glaring oversight on Microsoft's part. With a set cadence of 12 months per .NET release, these upgrades should be easy to accommodate. .NET 5's release wasn't a surprise to anyone, and this incongruity with the .NET release cycle should be better addressed. I hope this can be remedied quickly as our upgrade is on hold until the support is there.
Currently, .NET functions run inside the Azure Functions host. The host is something that runs in production for all of our customers (regardless of language) and we take upgrading it very seriously. This means when new versions of .NET is released, it’s more than just recompiling against the new framework and shipping it. We need to go through a preview process before we can declare GA.
This is also the reason why we are not updating the host to .NET 5. We’d need to support the host longer than .NET 5’s planned its end of life.
For .NET 5, we are building a completely new language worker that runs in a separate process from the host, like the workers for other languages. Because it’s built from the ground up, it’s taking longer to get ready.
The good news is that we believe the out-of-process model will allow us to do a better job of keeping up with future .NET releases, as it’s just a NuGet package now.
Thanks for your patience on this. We want to ship this as much as you all want to get your hands on it. 🙂
Thanks for your update @anthonychu.
The host for the new .NET 5 language worker will run on .NET 5 or still run on Net Core 3.1? In case of still on .Net Core 3.1 there is any plan to upgrade the host or use a different host based on .NET 5 in order to enjoy all .NET 5 the performance benefits not only in our code but also in the host code?
AWS Lambdas support .NET 5 but Azure Functions don't. Is there any alternative in Azure?
Thanks for your update @anthonychu.
The host for the new .NET 5 language worker will run on .NET 5 or still run on Net Core 3.1? In case of still on .Net Core 3.1 there is any plan to upgrade the host or use a different host based on .NET 5 in order to enjoy all .NET 5 the performance benefits not only in our code but also in the host code?
The host will still be .NET Core 3.1. As mentioned before, the host cannot take a dependency on .NET 5 because it's not LTS. We are planning to update the host for .NET 6.
We are still on track for a preview of the .NET 5 worker later this month.
We are planning to update the host for .NET 6
Update it to .NET 6 I guess... Does this mean it will be LTS?
@ShockwaverReal Yes, .NET 6 will be LTS.
What problem would the feature you're requesting solve? Please describe.
Azure Functions V3 project does not build with .NET 5 SDK
Describe the solution you'd like
Azure Functions V3 project should not error out with .NET 5 SDK
Describe alternatives you've considered
N/A
Additional context
Tried running Azure Functions V3 in .NET 5 docker container
*.csproj
file> dotnet --info
Runtime Environment: OS Name: debian OS Version: 10 OS Platform: Linux RID: debian.10-x64 Base Path: /usr/share/dotnet/sdk/5.0.100-rc.1.20452.10/
Host (useful for support): Version: 5.0.0-rc.1.20451.14 Commit: 38017c3935
.NET SDKs installed: 5.0.100-rc.1.20452.10 [/usr/share/dotnet/sdk]
.NET runtimes installed: Microsoft.AspNetCore.App 5.0.0-rc.1.20451.17 [/usr/share/dotnet/shared/Microsoft.AspNetCore.App] Microsoft.NETCore.App 5.0.0-rc.1.20451.14 [/usr/share/dotnet/shared/Microsoft.NETCore.App]
To install additional .NET runtimes or SDKs: https://aka.ms/dotnet-download