After upgrading 'Microsoft.Extensions.Logging.Abstractions' package to latest version , azure function is not working

lakshmi 816 Reputation points
2024-02-08T14:16:22.2733333+00:00

As a part of package updation, we have updated 'Microsoft.Extensions.Logging.Abstractions, to the latest version 8 and after this azure function is not working and we are seeing below error message in azure function User's image

While build locally also we are getting the below error, Microsoft.Azure.WebJobs.Script: Error configuring services in an external startup class. AzureFunction: Could not load file or assembly 'System.ComponentModel, Version=7.0.0.0, Culture=neutral, PublicKeyToken=fghfg'. The system cannot find the file specified.

Azure Functions
Azure Functions
An Azure service that provides an event-driven serverless compute platform.
5,930 questions
{count} votes

Accepted answer
  1. MuthuKumaranMurugaachari-MSFT 22,441 Reputation points Moderator
    2024-02-08T15:59:16.2766667+00:00

    It looks like you are using in-process model which only supports .NET 6.0 (LTS). If you are looking to use .NET 7.0 or .NET 8.0, I suggest you use isolated model as described in https://learn.microsoft.com/en-us/azure/azure-functions/functions-dotnet-class-library?tabs=v4%2Ccmd#supported-versions.

    To answer the question on the exception, the dependencies are restricted to 6.0.0 as discussed in this thread and you might face similar errors with unsupported version like .NET 7.0 (similar discussions: https://github.com/Azure/azure-functions-host/issues/9685#issuecomment-1812042873, https://github.com/Azure/Azure-Functions/issues/2319). Hence you can either downgrade and validate with .NET 6.0 for in-process model or move to Isolated model for latest .NET versions.

    I hope this helps and let me know if any questions.


    If you found the answer to your question helpful, please take a moment to mark it as Yes for others to benefit from your experience. Or simply add a comment tagging me and would be happy to answer your questions.

    0 comments No comments

1 additional answer

Sort by: Most helpful
  1. mittakori neha 0 Reputation points
    2024-09-17T04:52:31.47+00:00

    Hi,
    I am also facing the similar issue. Recently I have migrated the Azure function apps from .net 6 to .net 8 with inprocess model itself . So within my .csproj file I have updated the target framework to .net 8 and updated the "Microsoft.NET.Sdk.Functions" Version="4.1.1" to "4.4.1. It didnt give any runtime time errors in my local. I was even able to execute the functions. But when deployed to azure portal it was giving the below error. Can someone please help.
    User's image


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.