I have an API and a separate Azure Functions app. I upgraded my API app to .NET 5
and it's working fine. In the API app's solution, I have class library projects that I also reference in my Azure Functions app. These class libraries are netstandard2.1
projects.
Ever since this update -- during which I also updated all my NuGet packages to latest versions -- my Azure Functions app stopped working. I'm getting the following error:
Could not load file or assembly 'Microsoft.Extensions.Configuration.Abstractions, Version=5.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60'. The system cannot find the file specified. Value cannot be null. (Parameter 'provider')
I noticed that there were breaking changes involving the Microsoft.Extensions.*
packages and their recommendation is to install the package that is causing the issue directly. So I added Microsoft.Extensions.Configuration.Abstractions
to my Azure Functions manually -- before it was being installed as a dependency of Microsoft.Extensions.Configuration
package. Here's the information about this:
https://github.com/dotnet/aspnetcore/issues/21033
The issue still persists. I even tried downgrading Microsoft.Extensions.Configuration
in both the API and Functions app, but I'm still getting the same error.
Any idea how to resolve this issue?
Sam's comment should be accepted as correct answer. I try it out to downgrade Microsoft.Extensions*
(in my case Microsoft.Extensions.Logging.Console
) from 5.0.0
to 3.1.0
and the error just gone.
Bravo!
As a reference, this GitHub link explains exactly why that happens.
And as of now, you either track down the exact versions been referenced or downgrade everything to the latest v3 build.
In a nutshell, Azure Functions SDK already has some dependencies loaded in memory, so your libraries cannot use newer versions of the same libraries.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With