Reputation: 904
Last week I created a ASP.NET 5 MVC project using VS.NET 2015 Preview. I then used NuGet to get the MongoDB driver (mongocsharpdriver) and I wrote some code and with that added some documents to the database. I started a new project today along those same lines but it wouldn't build. It says the type or namespace MongoDB can't be found even though I have intellisense for it. So I opened the original project and now that one won't build, same exact error. My project properties is set to target CLR, not Core -- that MongoDB library doesn't work with Core. Has anyone run into this problem and know how to fix it? I'm pretty sure I'm not going crazy.
All I do to reproduce the problem is start a new ASP.NET Web Application, then pick ASP.NET 5 Starter Web, then install MongoDB from NuGet, then add an import to it in the HomeController.cs. Then it complains about it not being found in Core, even though I'm not targeting Core.
This is the error when compiling following my steps above:
Error CS0246 The type or namespace name 'MongoDB' could not be found (are you missing a using directive or an assembly reference?) Bug.ASP.NET Core 5.0 HomeController.cs
Upvotes: 8
Views: 2114
Reputation: 17485
As per my best knowledge ASP.net core 5.0 framework does not support many of existing Nuget library and assembly.
Go to project.json and remove ASP.net Core 5 from framework section.
Upvotes: 12