[CSHARP-2332] Error installing MongoDB.Bson package from nuget Created: 18/Jul/18  Updated: 28/Oct/23  Resolved: 05/Feb/19

Status: Closed
Project: C# Driver
Component/s: Build
Affects Version/s: 2.7.0
Fix Version/s: 2.8.0

Type: Improvement Priority: Major - P3
Reporter: Matteo Mosca [X] Assignee: Vincent Kam (Inactive)
Resolution: Fixed Votes: 2
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

Windows 10 x64, VS 2017, net core 2.1.2


Attachments: PNG File image-2018-10-29-09-52-52-480.png     PNG File image-2018-10-29-09-58-17-541.png    
Issue Links:
Related
related to CSHARP-2394 Remove dependency on System.Reflectio... Closed

 Description   

I've create an empty .Net Core console application. Then I added using NuGet:

  • MongoDB.Driver : Ok
  • MongoDB.Driver.Core: Ok
  • MongoDB.Bson: I get the following error:

Detected package downgrade: System.Reflection.Emit.Lightweight from 4.3.0 to 4.0.1. Reference the package directly from the project to select a different version.  TestMongoDb -> MongoDB.Bson 2.7.0 -> NETStandard.Library 1.6.1 -> System.Linq.Expressions 4.3.0 -> System.Reflection.Emit.Lightweight (>= 4.3.0)  TestMongoDb -> MongoDB.Bson 2.7.0 -> System.Reflection.Emit.Lightweight (>= 4.0.1)

The package installation rolls back. There's nothing more I can do.



 Comments   
Comment by Ehssan Atassi [ 06/Mar/19 ]

I had the same problem on .Net Core 2.2 when installing MongoDB.Bson v2.7.2

mdmoazzem's workaround fixed the issue. 

Comment by Vincent Kam (Inactive) [ 04/Feb/19 ]

Hi mrossini@maskott.com et al.,

My apologies for the delay in responding to you all here: our backlog was a little flooded, but we're working towards clearing it!

I can confirm that the current workaround is to install the System.Reflection.Emit.Lightweight package from NuGet. We've fixed this dependency issue in master, so the next release (2.8.0) we make should contain the fix.

 

Kind regards,
Vincent

Comment by Karl Von Richter [ 10/Jan/19 ]

I had the same problem on .Net Core 2.2 when installing MongoDB.Bson v2.7.2

mdmoazzem's workaround fixed the issue. 

Comment by Felipe Bittencourt de Souza [ 28/Dec/18 ]

I had the same problem.

Installing "System.Reflection.Emit.Lightweight" NuGet package, like mdmoazzem said, solved it.

Thanks!

Comment by Md Masroor Moazzem [ 29/Oct/18 ]

I've had the same issue. Instead of Nikita's workaround, I added System.Reflection.Emit.Lightweight to the nuget packages. Doing so let me get mongodb.driver.

Comment by Ross Buggins [ 26/Oct/18 ]

Same Issue here on MongoDB.Bson 2.7.0

Comment by Maxime Rossini [ 30/Sep/18 ]

Same issue here. We are in the process of migrating from .NET framework to .NET Core, and this is an issue we would like to see fixed. Very simple to reproduce: create a new .NET Core 2.1 class library, and simply add a reference to the nuget package MongoDB.Bson.

If this is of any help, we are using Visual Studio 2017 15.8.5. The issue exists for MongoDB.Bson 2.5.0+ (not present in 2.4.4).

MongoDB.Driver team needs to give a little feedback on this type of issue (we have another issue regading .NET 4.7.1, and had no feedback either). At least some message to acknowledge the issue, and ideally give a target version/date for the fix. The workaround suggested by @Nikita Kudin is not acceptable, I don't want to include such a massive dependency in a simple class library.

Comment by Nikita Kudin [X] [ 29/Aug/18 ]

I have the same major error. 

I am using .NET Core 2.1 + Azure Service Fabric Cluster

Any updates, guys?

 

UPDATE:
I fixed it by adding Microsoft.AspNetCore.All from nuget. It's crazy, but works.

Generated at Wed Feb 07 21:42:15 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.