Upgrade an Azure function from .NET 6 to .NET 8

Posted: January 24, 2024  |  Categories: Azure

This is a war-story about an upgrade of an Azure function. I hope this might help some else.


I started to upgrade one of our functions because the community EOL date for .NET 6 is November 12, 2024. Very quickly I ran into issues. After deploying I observe this runtime error.

Microsoft.Azure.WebJobs.Script.ExternalStartupException : Error configuring services in an external startup class. ---> System.IO.FileNotFoundException : Could not load file or assembly 'Microsoft.Extensions.Configuration.Abstractions, Version=, Culture=neutral, PublicKeyToken=adb9793829ddae60'. The system cannot find the file specified. at ISApis.Startup.Configure(IFunctionsHostBuilder builder) at Microsoft.Azure.WebJobs.WebJobsBuilderExtensions.ConfigureStartup(IWebJobsStartup startup,WebJobsBuilderContext context,IWebJobsBuilder builder) at ......

How did I upgrade an Azure function

The Azure function in question was first developed using .NETCore3. Thus, it has already been through one upgrade to .NET 6.0(LTS) using an in-process model. The code was written by some else and I did not want to dig in to all the code. All I saw at a glance was that it uses a startup.cs file with dependency injection. Furthermore, it connects to a database behind a VNet before returning a result. Finally, it runs on a Linux App service.

I knew I was targeting .NET 8.0(LTS) using an isolated model because an in-process model is no longer supported. Thus, I thought that all I had to do was;

  1. Upgrade the function app to .NET6.0 and dotnet-isolated.
  2. Edit the function app csproj to the same target framework.

Editing the function app devops to .NET6.0 and dotnet-isolated and deploying I see.

Editing the function C# project and deploying via devops yield the runtime error “Error configuring services in an external startup class.”.

<Project Sdk="Microsoft.NET.Sdk">

Alas nothing is simple in this world.


Firstly, checking that my Visual Studio was the correct version and that .NET8.0 was present gave the thumbs up.

Secondly, on attempting to deploy to the function app from Visual Studio Code and Visual Studio 2022 I saw a deployment error.

There is no Functions runtime available that matches the version specified in the project

Eventually, the solution was downgrading to .NET6 and then using the Visual Studio wizard to upgrade to .NET8. This changes a few .nuget packages, adds a program.cs file and some extra application configuration values.

    "value": "true",
    "slotSetting": false
    "value": "1",
    "slotSetting": false
    "value": "true",
    "slotSetting": false

Consequently, the moral of the story is to trust the .net upgrade wizard to do the right things. Furthermore, don’t hand edit project files because you think you know what you are doing.

Now I was able to run the function app locally and deploy to the function app without an error. Unfortunately deploying to the function app still shows the same runtime error.

Thirdly, deleting the function app and then recreating using devops does not make the error go away. This shows even before deploying the function.

Finally, deleting the function app with powershell and then deploying using devops the runtime error is gone. Subsequently the Azure function deploys successfully and runs without error.


I have shown how to solve two errors, firstly “There is no Functions runtime available that matches the version specified in the project” and secondly “Error configuring services in an external startup class“. Solve the first one by using the .NET upgrade wizard. Solve the second one by deleting a bad version of a function app with powershell.


Back to Top