如何从Visual Studio Online运行实体框架的migration.exe? [英] How can I run Entity Framework's migrate.exe from Visual Studio Online?

查看:72
本文介绍了如何从Visual Studio Online运行实体框架的migration.exe?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经使用Visual Studio Online构建定义为我的项目设置了持续集成.

I have set up continuous integration for my project with Visual Studio Online build definitions.

当涉及到将数据库部署到Azure测试环境中时,我只是使用正确的发布设置来构建SQL Server Database Project.

When it comes to deploying my database (to an Azure test environment) I just build my SQL Server Database Project with the right publishing settings.

但是我想切换到Entity Framework的代码优先方法,并利用迁移功能,这需要我调用migration.exe.

But I want to switch to Entity Framework's code first approach and leverage the migration feature, which requires me to call migrate.exe.

我的问题是-如何从VSO构建定义中运行migration.exe?

My question is - how could I run migrate.exe from VSO build definitions?

推荐答案

我假设您正在使用vNext构建,请首先在构建定义中添加"Nuget Installer"任务,以在构建过程中恢复实体框架. Migrate.exe将安装在\ packages \ EntityFramework.\ tools文件夹中.然后添加命令行"任务以运行migrate.exe.在工具"区域中输入"\ packages \ EntityFramework.\ tools \ migrate.exe",并在参数"字段中输入参数.

I assume you are using vNext build, add a "Nuget Installer" task in your build definition first to restore the Entity Framework during the build. Migrate.exe will be installed in \packages\EntityFramework.\tools folder. Then add a "Command Line" task to run the migrate.exe. Enter "\packages\EntityFramework.\tools\migrate.exe" in "Tool" area and the arguments in "Arguments" field.

这篇关于如何从Visual Studio Online运行实体框架的migration.exe?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆