I started developing an MVC app on my laptop, which was running VS2013, and SQL server 2008 R2. I copied this project over to my desktop computer running Visual Studio 2013, SQL server 2012 Developer Edition.
When I run this MVC app from my Desktop, I get the following error on the line where I set the Initializer, as can be seen below:
public class MvcApplication : System.Web.HttpApplication
{
protected void Application_Start()
{
Database.SetInitializer<LiquorContext>(new LiquorContextInitializer());
AreaRegistration.RegisterAllAreas();
FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
RouteConfig.RegisterRoutes(RouteTable.Routes);
BundleConfig.RegisterBundles(BundleTable.Bundles);
}
}
This is the exception I get:
Additional information: The type initializer for 'System.Data.Entity.DropCreateDatabaseAlways`1' threw an exception.
I have used Nuget console to update my packages, as follow:
Update-Package -reinstall EntityFramework
Update-Package -reinstall Microsoft.AspNet.Identity.EntityFramework
Update-Package -reinstall Microsoft.Owin.Host.SystemWeb
Update-Package -reinstall Microsoft.Owin.Security.Cookies
None of my attempts have worked so far, and I cannot figure out what needs to change to fix this.
Any help would be appreciated.
NB: I have noticed the Entity Framework version has changed from version 6.1.2 to 6.1.3, but I was receiving this error before I updated Entity Framework Package.