Question
Is there any ways that I can automatically execute the migration code (EF 7) when publishing my ASP 5 application to IIS using Web Deploy?
I Tried
in the project.json
, I added this code in the scripts
:
"scripts" : {
"prepublish": ["dnx ef database update", "other commands..."],
"postpublish": ["dnx ef database update"]
}
none worked for me.
Additional Info
I followed the instructions on this link to deploy my ASP 5 RC-1 web application to IIS using web deploy.
After doing so in the publish settings I have:
Using web deploy in ASP 4 applications I have additional database options:
So I added the option -environment
to my ef database
command. Now it works:
"postpublish": ["dnx ef database update -e Staging"]
I have four different appsettings.json
which different connection string for each environment. Just needed to indicate the environment for the command to work.