/ notes
/ azfunctions
Updatading Azure Function from NET 6 to NET 8 (in-process)
Solution/project
In the Function project file (.csproj):
- Change target framework to net 8
<TargetFramework>net8.0</TargetFramework>
- Add (if required)
<_FunctionsSkipCleanOutput>true</_FunctionsSkipCleanOutput>
In the function project:
- Update
Microsoft.NET.Sdk.Functions
to 4.5.0 or later
Example of resulting project file:
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<AzureFunctionsVersion>v4</AzureFunctionsVersion>
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
<_FunctionsSkipCleanOutput>true</_FunctionsSkipCleanOutput>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.Azure.Functions.Extensions" Version="1.1.0" />
<PackageReference Include="Microsoft.NET.Sdk.Functions" Version="4.6.0" />
</ItemGroup>
In the local.settings.json file, add "FUNCTIONS_INPROC_NET8_ENABLED": "1",
"Values": {
"AzureWebJobsStorage": "UseDevelopmentStorage=true",
"FUNCTIONS_INPROC_NET8_ENABLED": "1",
"FUNCTIONS_WORKER_RUNTIME": "dotnet",
Deployment
- From Azure Potal, stop the Function App
- Environment variables:
- add
"FUNCTIONS_INPROC_NET8_ENABLED": "1"
- add
- Configuration:
- set
NET Version
to"NET 8 (LTS) In-process"
- set
- Deploy the new version of function app, updated to NET8
- Start the Function App
If you have issues at the startup, like missing assemblies, try adding <_FunctionsSkipCleanOutput>true</_FunctionsSkipCleanOutput>
to the project file, and redeploy the function app.
.