Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
283 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 Reply

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


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

1.4m articles

1.4m replys

5 comments

57.0k users

...