KingDan KingDan - 11 months ago 185
C# Question

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):

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.

Answer Source


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.

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: