无法加载文件或程序集'System.Buffers,Version = 4.0.2.0 ...' [英] Could not load file or assembly 'System.Buffers, Version=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,Version = 4.0.2.0…'
Could not load file or assembly 'System.Buffers, Version=4.0.2.0…'
解决方案
1)使用CMD(以Administrator身份运行)并键入
1) use CMD(run as Administrator ) and type
cd xxxx(xxxx\packages\System.Buffers.4.5.1\lib\netstandard2.0))
运行
gacutil /i System.Buffers.dll
然后,完成后,请在 package manager控制台
下运行 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.
此外,还有 查看全文