无法在 Azure Functions 中加载文件或程序集“Microsoft.Extensions.Configuration.Abstractions,版本 = 5.0.0.0 [英] Could not load file or assembly 'Microsoft.Extensions.Configuration.Abstractions, Version=5.0.0.0 in Azure Functions

查看:72
本文介绍了无法在 Azure Functions 中加载文件或程序集“Microsoft.Extensions.Configuration.Abstractions,版本 = 5.0.0.0的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个 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'.系统无法找到指定的文件.值不能为空.(参数提供者")

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')

我注意到涉及 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 Functions 中加载文件或程序集“Microsoft.Extensions.Configuration.Abstractions,版本 = 5.0.0.0的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆