/ notes / azfunctions

Updatading Azure Function from NET 6 to NET 8 (in-process)

Solution/project

In the Function project file (.csproj):

In the function project:

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

  1. From Azure Potal, stop the Function App
  2. Environment variables:
    • add "FUNCTIONS_INPROC_NET8_ENABLED": "1"
  3. Configuration:
    • set NET Version to "NET 8 (LTS) In-process"
  4. Deploy the new version of function app, updated to NET8
  5. 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.

.