无法加载文件或程序集“System.Buffers,版本 = 4.0.2.0 ..."

Could not load file or assembly #39;System.Buffers, Version=4.0.2.0...#39;(无法加载文件或程序集“System.Buffers,版本 = 4.0.2.0 ...)
本文介绍了无法加载文件或程序集“System.Buffers,版本 = 4.0.2.0 ..."的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在使用 VS config 添加新配置后尝试调用 MongoClient 类的 GetDatabase 方法时出现以下异常.经理:

I'm getting the following exception when trying to call GetDatabase method of the MongoClient class after adding a new configuration using VS config. manager:

Could not load file or assembly 'System.Buffers, Version=4.0.2.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)

我安装了最新的 System.Buffer nuget 包 v4.5.1,在我的 app.config 中创建了dependentAssembly,并在我的 .csproj 文件中创建了 Reference,但我仍然遇到同样的问题.出于某种原因,它尝试使用 v4.0.2 引用 System.Buffer.有没有人遇到过类似的错误,你是怎么解决的?

I installed the latest System.Buffer nuget package v4.5.1, created dependentAssembly in my app.config and Reference in my .csproj file, but I still have the same issue. For some reason it tries to reference System.Buffer with v4.0.2. Has anyone had a similar error and how did you solve it?

推荐答案

无法加载文件或程序集System.Buffers,版本=4.0.2.0…"

Could not load file or assembly 'System.Buffers, Version=4.0.2.0…'

解决方案

1)使用CMD(以管理员身份运行)并输入

1) use CMD(run as Administrator ) and type

 cd xxxx(xxxxpackagesSystem.Buffers.4.5.1lib
etstandard2.0))

运行

gacutil /i System.Buffers.dll

那么,完成后,请在package manager console下运行update-package -reinstall重新安装包.

Then, when you finish it, please run update-package -reinstall under package manager console to reinstall the package.

2)您可以尝试将csproj文件中的Version=4.0.2.0改为Version=4.0.3.0.

2) you can try to change Version=4.0.2.0 to Version=4.0.3.0 in csproj file.

除此之外,还有 类似问题可以参考.

这篇关于无法加载文件或程序集“System.Buffers,版本 = 4.0.2.0 ..."的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!

本站部分内容来源互联网,如果有图片或者内容侵犯您的权益请联系我们删除!

相关文档推荐

DispatcherQueue null when trying to update Ui property in ViewModel(尝试更新ViewModel中的Ui属性时DispatcherQueue为空)
Drawing over all windows on multiple monitors(在多个监视器上绘制所有窗口)
Programmatically show the desktop(以编程方式显示桌面)
c# Generic Setlt;Tgt; implementation to access objects by type(按类型访问对象的C#泛型集实现)
InvalidOperationException When using Context Injection in ASP.Net Core(在ASP.NET核心中使用上下文注入时发生InvalidOperationException)
LINQ many-to-many relationship, how to write a correct WHERE clause?(LINQ多对多关系,如何写一个正确的WHERE子句?)