问题描述
我有一个 API 和一个单独的 Azure Functions 应用程序.我将我的 API 应用程序升级到 .NET 5
并且它工作正常.在 API 应用程序的解决方案中,我在 Azure Functions 应用程序中也引用了一些类库项目.这些类库是 netstandard2.1
项目.
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.
自从这次更新之后——在此期间我还将所有 NuGet 包更新到最新版本——我的 Azure Functions 应用程序停止工作.我收到以下错误:
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:
无法加载文件或程序集'Microsoft.Extensions.Configuration.Abstractions,版本=5.0.0.0,文化=中性,PublicKeyToken=adb9793829ddae60'.系统不能找到指定的文件.值不能为空.(参数'提供者')
我注意到有涉及 Microsoft.Extensions.*
包的重大更改,他们的建议是直接安装导致问题的包.所以我手动将 Microsoft.Extensions.Configuration.Abstractions
添加到我的 Azure Functions 中——在它作为 Microsoft.Extensions.Configuration
包的依赖项安装之前.以下是关于此的信息:https://github.com/dotnet/aspnetcore/issues/21033
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
问题仍然存在.我什至尝试在 API 和 Functions 应用程序中降级 Microsoft.Extensions.Configuration
,但我仍然遇到相同的错误.
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 的评论应该被接受为正确答案.我尝试将 Microsoft.Extensions*
(在我的例子中是 Microsoft.Extensions.Logging.Console
)从 5.0.0
降级到 3.1.0
并且错误消失了.好样的!
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!
这篇关于无法在 Azure 函数中加载文件或程序集“Microsoft.Extensions.Configuration.Abstractions,版本 = 5.0.0.0"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!