0

I am building a WebApp and hosting it on Azure that uses a SQL Server database. This is an Asp .Net Core MVC application that uses Entity Framework Core with Migrations. I am also using the Continuous Integration in Team Services to build and release my changes to my production site.

My question is: When I change my data model, execute the Add-Migrations & Update-Database, and then check in my changes (which triggers a build & Release), I want to make sure that the migrations are also implemented on the production database when the build or release is performed.

Can somebody please show me how to accomplish this within the Team Services "Build & Release" management?

Thank you,

  • A related thread: https://stackoverflow.com/questions/44957938/run-ef-migration-on-vsts-release, you may try it with profile. – starian chen-MSFT Jul 10 '17 at 08:13
  • Hello @starain-MSFT, Thankyou for your suggested reference. I did look at the question you pointed out and there is a (somewhat) answer, but I needed to as the poster (donquijote), a question. However, being so new on Stackoverflow, I only have 23 reputation points and can not submit comments to other posts (other than answers). The answer said to use three parameters, but I don't know where to find the values for those parameters. There's got to be a way to do this. It's really getting frustrating. –  Jul 12 '17 at 17:02
  • It is the build variable that you added (variables tab of build definition). You can use /p:DeployOnBuild=true /p:PublishProfile=CustomProfile;DesktopBuildPackageLocation=‌​‌​"$(build.artifacts‌​ta‌​gingdirectory)\W‌​ebAp‌​pCore.zip" argument directly for Visual Studio Build task. BTW, for that thread, it is a general MVC project instead of .net Core app. The result of mine: the migrationHistory table is empty after deploying to azure app. But you could try it and check the result. – starian chen-MSFT Jul 13 '17 at 02:10

0 Answers0