Could not load file or assembly #39;System.Buffers, Version=4.0.2.0...#39;(无法加载文件或程序集“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 ..."的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:无法加载文件或程序集“System.Buffers,版本 = 4.0.2.0 ..."
基础教程推荐
- SonarQube C# 分析失败“不是指针的有效行偏移" 2022-01-01
- 获取C#保存对话框的文件路径 2022-01-01
- 从 C# 控制相机设备 2022-01-01
- 更新 Visual Studio 中的 DataSet 结构以匹配新的 SQL 数据库结构 2022-01-01
- 在 VB6 或经典 ASP 中使用 .NET 2022-01-01
- 重新排序 WPF TabControl 中的选项卡 2022-01-01
- C# 9 新特性——record的相关总结 2023-04-03
- 如果条件可以为空 2022-01-01
- Mono https webrequest 失败并显示“身份验证或解密失败" 2022-01-01
- 将数据集转换为列表 2022-01-01
