Home Can't Execute Code First Migrations in Web Deploy

# Can't Execute Code First Migrations in Web Deploy

Flexabust Bergson
1#
Flexabust Bergson Published in 2017-09-14 08:21:44Z
 I'm trying to deploy my ASP.NET MVC5 website to test following this tutorial: https://docs.microsoft.com/en-us/aspnet/web-forms/overview/deployment/visual-studio-web-deployment/deploying-to-iis In the part about "Configure deployment for the application database" point 2, I need to check a box that is not avaible on my screen(Execute Code First Migrations). My problem being the following : I have an onion architecture, hence my project containing the context of Entity Framework is in a separate project (and I'm deploying the asp.net MVC 5 project), so that means I cannot enable-migrations in this project. I've also changed my connection strings to fit the name of my context as precised in this post : https://stackoverflow.com/a/32866872/4714502 . On the other hand, my DbSet have different names then my Entity Framework classes, would that be an issue? I did this because the syntax of my tables is quite awkward, and was a requirement (I did not want to use this naming convention in my application). Say for a table Web_Documents : DbSet WebDoc { get; set; } As for the architecture I have : Entities (POCO) Repository (context is here) Service UI (MVC) (Deploy here) Dependencies go from 4 to 1. And here is my app.config in Repository: 
 My db's name is PrincipalServerDB and the context PrincipalServerContext Now I'm out of ideas, don't really know what else I can do?
Ogglas
2#
 Create an App.config file in the project containing the context and add your connectionString there. Match Web.config structure. Example: 
 After this set context project as StartUp Project, in PMC set it as Default project and after this run Update-Database. Now it will update.