EF 6.2.0 migrate.exe错误:对象引用未设置为对象的实例

时间:2018-03-20 08:37:13

标签: entity-framework ef-migrations

我正在设置migrate.exe以在VSTS发布期间运行数据库迁移:
migrate.exe DataAccess.dll /connectionProviderName="System.Data.SqlClient" /connectionString="Data Source=SQLXXX\DEV01;Initial Catalog=XXXXX;Integrated Security=true;" /verbose 输出:

VERBOSE: Target database is: 'XXXXX' (DataSource: SQLXXX\DEV01, Provider: System.Data.SqlClient, Origin: Explicit).
No pending explicit migrations.
Running Seed method.
System.Data.Entity.Migrations.Design.ToolingException: Object reference not set to an instance of an object.
   at System.Data.Entity.Migrations.Design.ToolingFacade.Run(BaseRunner runner)
   at System.Data.Entity.Migrations.Console.Program.Run()
   at System.Data.Entity.Migrations.Console.Program.Main(String[] args)
ERROR: Object reference not set to an instance of an object.

我们在Seed方法中没有代码。预计会No pending explicit migrations,但我们需要脚本完成而不会出现错误,以便继续发布过程。如何解决此错误?

I raised this issue on EF6 GitHub

1 个答案:

答案 0 :(得分:0)

为了使其工作,我必须提供/ startupConfigurationFile而不是/ connectionString。