Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

MongoDB + .NET Core 1.0?

so I'm working on an app backend with .NET Core 1.0 and have a bunch of the work already put in. I guess it's my own fault for not checking beforehand, but apparently the latest version of MongoDB's C# driver (2.2.4) is not compatible with .NET Core 1.0?

I get errors like these for all the relevant dependencies:

The dependency MongoDB.Bson 2.2.4 does not support framework .NETCoreApp,Version=v1.0.  

I came across this guide on how to get it working with RC2 but we're a bit past that point now (I'd be reluctant to use a release candidate version for a real project like this): http://blog.stoverud.no/posts/referencing-net451-libraries-in-aspnet-core/

The above guide isn't working for me. Adding the framework under "frameworks" in the project JSON file just creates another unsupported error similar to the one above.

Is there a way to get this done or should I be looking at another database? I don't know too many database projects. I need to use NoSQL.

like image 711
Dan Avatar asked Dec 15 '22 04:12

Dan


1 Answers

Update:

The version 2.3.0 has been officially released and it is compatible with .NET Core 1.0, so I guess this question is no longer relevant. https://www.nuget.org/packages/MongoDB.Driver/2.3.0


Old answer:

The version 2.3.0 is currently in beta and I was able to add it to my .net core app, I haven't done much work with it so I don't know the current limitations/bugs.

Add to your project.json file the dependency:

 "MongoDB.Driver.Core": "2.3.0-beta1"

Or use the Include prerelease checkbox in the NuGet manager and search for the MongoDB.Driver.Core package.

According to this page, it seems they are close to finish it: https://jira.mongodb.org/browse/CSHARP-1177

like image 79
Juan Arias Avatar answered Dec 27 '22 23:12

Juan Arias