无法加载文件或程序集“System.Buffers,版本 = 4.0.2.0 ..." [英] Could not load file or assembly 'System.Buffers, Version=4.0.2.0...'

查看:19
本文介绍了无法加载文件或程序集“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 ..."的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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