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

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

问题描述

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

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

在部署我的数据库(到 Azure 测试环境)时,我只是使用正确的发布设置构建我的 SQL Server 数据库项目.

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 的代码优先方法并利用迁移功能,这需要我调用 migrate.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 构建定义运行 migrate.exe?

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

推荐答案

我假设您正在使用 vNext 构建,首先在构建定义中添加Nuget 安装程序"任务以在构建期间恢复实体框架.Migrate.exe 将安装在 packagesEntityFramework. ools 文件夹中.然后添加一个命令行"任务来运行 migrate.exe.在工具"区域输入packagesEntityFramework. oolsmigrate.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 packagesEntityFramework. ools folder. Then add a "Command Line" task to run the migrate.exe. Enter "packagesEntityFramework. oolsmigrate.exe" in "Tool" area and the arguments in "Arguments" field.

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

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