how to fix this error "Microsoft.Extensions.Azure: Could not load file or assembly 'System.Diagnostics.Tracing, Version=5.0.0.0,"

Viewed 2158

there’s a problem that I didn’t understand where it came from because the script worked yesterday , I woke up and I found this problem that wasn’t there yesterday. I’m working on a project (net 5.0) that contains Azure Function ,Entity Framework Core ,Microsoft Graph.

Error :

Microsoft.Extensions.Azure: Could not load file or assembly 'System.Diagnostics.Tracing, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'. Impossibile trovare il file specificato.
6 Answers

If you updated your function to .NET 6, you need to use Azure Functions v4. Add this below to the function configuration in the Azure portal:

FUNCTIONS_EXTENSION_VERSION = "~4"

If you upgraded to .NET 6 and are seeing this when running the function locally, change your .csproj file:

<AzureFunctionsVersion>v4</AzureFunctionsVersion>

I upgraded from version3 to version 4 and it was working in my local environment, but not on Azure Portal. I removed:

[assembly: FunctionsStartup(typeof(Startup))]

…but that caused another issue with dependency injection.

The solution was to change FUNCTIONS_EXTENSION_VERSION to ~4 in Azure Portal in Configuration.

Could not load file or assembly 'xxx'

This kind of problem is usually caused by version incompatibility. Upgrading or downgrading the assembly should be able to solve your problem.

I had the same issue after upgrading to Azure Function v4 caused by an outdated Azure Function Core Tools (download the latest version here.)

You can check your Function Core Tools version using func version. Be sure it is > 4.0 when using Azure Function v4!

Related