使用 ef6.exe 错误迁移:值不能为 NULL参数名称:path1

问题描述

我正在尝试使用 ef6.exe 从 CLI 迁移,但我不断收到错误消息,而且我无法弄清楚我遗漏了什么,因为数据库更新工作正常。我有两个具有不同配置的上下文。我明确地尝试了连接字符串,并从 web.config 获取它,但都没有帮助。

Scaffolding migration 'testMigration'.
System.ArgumentNullException: Value cannot be NULL.
Parameter name: path1
   at: System.IO.Path.Combine(String path1,String path2)
   at: System.Data.Entity.Tools.Commands.ProjectCommandBase.WriteMigration(ScaffoldedMigration scaffoldedMigration,Boolean rescaffolding,Boolean force,String name)
   at: System.Data.Entity.Tools.Commands.MigrationsAddCommand.Execute()
   at: Microsoft.DotNet.Cli.CommandLine.CommandLineApplication.Execute(String[] args)
   at: System.Data.Entity.Tools.Program.Main(String[] args)
Value cannot be NULL.
Parameter name: path1

我正在使用的命令:

ef6.exe migrations add testMigration --migrations-config MyConfiguration --assembly MyAssembly.dll --connection-string-name “MyConnection” --config ..\Web.config --verbose  

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)