ASP.NET MVC Core/6: EF 6 scaffolding error

asp.net-core-mvc c# entity-framework-6

Question

I am using EF 6 with MVC Core/6. My models and db context are in separate project and I use DI to inject the db context into the controllers. But when I try to scaffold the controller using EF 6 as the data context class I am getting the following error:

Error

There was an error running the selected code generator: 'A type with the name MyProject.DAL.ModeIs.MyModel does not exist Microsoft.VisuaIStudio.Web.CodeGeneration.ActionInvokerb__6_0() Microsoft. Extensions.CommandLineUtiIs.CommandLineAppIication.Exe cute(String[] args) Microsoft.VisualStudio.Web.CodeGeneration.CodeGenCommand.Execu te(String[] args)'

1
1
6/9/2016 11:29:58 AM

Popular Answer

RC2 is the first release that somewhat allows you to include non-ASP.NET Core projects in your solution. From my experience I've learned it only works if both projects were created in Visual Studio 2015 Update 2 and they both use .NET Framework 4.6.1.

There is a long running issue on GitHub about this. I've struggled with the workarounds presented in that thread and couldn't waste anymore time messing with it. So I decided to wait until a functional release comes out. I put all my shared code in an ASP.NET Core (.NET Framework) project. Made it look like a class library project by creating an empty project and deleting everything except project.json. Then any functionality that is not supported in that stack, I put in a WebAPI 2 method that I can call from my RC2 project.

2
6/9/2016 12:26:30 PM


Related Questions





Related

Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow
Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow