Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Problems with mongo csharp driver version

I use the mongo csharp driver version 1.9.1. But, I have a problem with this dll. The exception is:

Could not load file or assembly 'MongoDB.Bson, Version=1.9.1.221, Culture=neutral, PublicKeyToken=f686731cfb9cc103' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)":"MongoDB.Bson, Version=1.9.1.221, Culture=neutral, PublicKeyToken=f686731cfb9cc103.

Does anybody have any suggestion ?

Thanks a lot in advance

like image 856
Dhibi_Mohanned Avatar asked Sep 17 '25 01:09

Dhibi_Mohanned


2 Answers

I was having the same problem, this error occurs due to conflict you may have added more than one reference to MonogoDb in your Solution. Solution: If there are more than one project in your solution remove MongoDb references from all project and then add to only one project that is dependent on all other projects. It worked for me.

like image 151
Amanullah Tariq Avatar answered Sep 19 '25 07:09

Amanullah Tariq


To build on Amanullah Tariq's answer; You may have more than one project referencing MongoDb or its drivers, HOWEVER; [solution] make sure that each project make use of the same version. That was what was causing my error. If the versions are not the same, make sure to either upgrade or downgrade the versions to match. I hope this helps any one struggling with this issue in the future.

like image 34
onmyway Avatar answered Sep 19 '25 05:09

onmyway