Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
276 views
in Technique[技术] by (71.8m points)

c# - Mongocsharpdriver not working with ASP:NET Core 5.0 (vNext)?

So I'm getting my feet wet with ASP.NET 5.0, and want to start off using MongoDB.

I've done this in several projects, just not in vNext before.

I add the "mongocsharpdriver" to the project.json and everything seems fine, but when I compile, I get a bunch of errors about mongo and ASP.NET 5 Core (The type or namespace name 'MongoDB' could not be found ...). No compile errors for regular ASP.NET 5, just for Core. Is mongocsharpdriver not support for Core? It doesn't seem to have any dependencies, but of course, I don't expect the mongo team to have it compile against Core just yet.

I've looked at this question Setup MongoDB in VNext, but it doesn't really help me, as I want to keep the project compiling for Core too!

Any input?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

You can use MongoDB with visual studio 2015 RC (published 30 april 2015).

remove 1 line from project.json;

"frameworks": {
    "dnx451": { }, // don't forget to remove ','
    "dnxcore50": { } // remove this line
}

now you can build your solution without any error or warning.

enter image description here enter image description here


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...