Reputation: 57562
I'd like to use ASP.NET MVC 6 with Entity Framework 6 with Migrations enabled. My Entity Framework 6 DbContext is in a separate assembly from the MVC 6 project. I can get Entity Framework 6 to work with MVC 6, but as soon as I enable Migrations, I get a FileNotFoundException
with the message Could not find file '{AssemblyName}.resources'.
Is there a way to get MVC 6 to work with EF 6 with Migrations?
Here's a test project I put on GitHub that demonstrates the problem: https://github.com/johnnyoshika/mvc6-ef6-migrations
Upvotes: 3
Views: 503
Reputation: 9806
I ran into this problem in beta7. It would seem ASP.NET 5 does not play nicely with resources (.resx) embedded in csproj projects. If you locally reference aspnet/Mvc and Entityframework (6), you'll see it's trying to show some helpful debug information, but does so using localisation. In your example it's trying to access the LoggingTargetDatabase
field from here but incorrectly expecting it to be embedded in Entity2
rather than EntityFramework
, due to what I suspect is ASP.NET 5's lacking support for .resx.
This was one of several issues I found attempting to get EF6 migrations in ASP.NET 5, and in the end I wrote a small DNX Command library [Github | myget] that would call EF6 migrations programatically, similar to how EF7 does it.
Upvotes: 2