Run EF migration on VSTS release

前端 未结 1 1215
悲哀的现实
悲哀的现实 2021-01-25 00:14

When I release my Asp.Net MVC app to azure web app using VSTS and a Hosted VS2017 agent, the EF Migration (to Azure SQL) doesn\'t execute on application start the same way it ca

1条回答
  •  深忆病人
    2021-01-25 00:56

    Is possible to have VSTS use the same Publish Profile as in VS which in my case is a Web Deploy process to Azure Web App and includes the option to run migrations on application start.

    In the VSTS build definition, Variables tab, add the following entries:

    DeployOnBuild: true

    PublishProfile: NameOfTheVSPublishProfileFile

    DesktopBuildPackageLocation: $(System.DefaultWorkingDirectory)/MyBuildFolderName/drop/MyProjectZipName.zip

    Then Build and Release.

    Next time you run the app the new migrations will execute in the same way as when publishing from VS.

    0 讨论(0)
提交回复
热议问题