EF 6.2.0 migrate.exe ERROR: Object reference not set to an instance of an object
EF 6.2.0 migrate.exe ERROR: Object reference not set to an instance of an object
我正在设置 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
是预期的,但我们需要脚本无错误地完成,发布过程才能继续。如何修复此错误?
为了让它工作,我必须提供 /startupConfigurationFile 而不是 /connectionString。
我正在设置 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
是预期的,但我们需要脚本无错误地完成,发布过程才能继续。如何修复此错误?
为了让它工作,我必须提供 /startupConfigurationFile 而不是 /connectionString。