Running update-database from Team City

99封情书 提交于 2019-12-02 19:11:00

migrate.exe is what I was looking for, it is found in "packages\EntityFramework.4.3.1\tools".

Add a new build step in Team City using:

Runner type: command line

Command executable: packages\EntityFramework.4.3.1\tools\migrate.exe

Command parameters: MyApplicationName /StartupDirectory:MyApplicationName\bin

angularsen

Install Entity Framework nuget to the repo and use the accompanying migrate.exe under packages\EntityFramework.5.0.0\tools\ or equivalent.

Then run a batch script like this:

SET AssemblyName=MyMvc4App
SET StartUpDirectory=MyMvc4App\bin\
SET ConnectionString=Server=tcp:XXXX.database.windows.net,1433;Database=XXXX;User ID=XXXX;Password=XXXX;Trusted_Connection=False;Encrypt=True;Connection Timeout=30;MultipleActiveResultSets=True
SET ConnectionStringProvider=System.Data.SqlClient
SET ConfigFilePath=%CD%\MyMvc4App\web.config
SET MigrateExe=packages\EntityFramework.5.0.0\tools\migrate.exe

%MigrateExe% %AssemblyName%.dll /startUpDirectory:%StartUpDirectory% /startUpConfigurationFile:"%ConfigFilePath%" /connectionProviderName:"%ConnectionStringProvider%" /connectionString:"%ConnectionString%" /verbose
pause

I answered a similar question and there I explain why I have yet to get it working without specifying a web/app.config file.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!