升级到 .NET Core 1.0 项目文件后,无法在 EF6 上 运行 'dotnet ef'

Cannot run 'dotnet ef' on EF6 after upgrading to .NET Core 1.0 project files

将所有 project.json 文件升级为 .NET 核心的新格式后,我无法 运行 'dotnet ef' 进行 Entity Framework 6 次迁移。有人能看出下面的 project.json 有什么问题吗?

在我的 project.json 看起来像这样之前:

{
   "frameworks": {
     "dnx46": {
       "dependencies": {
       }
     }
   },
   "dependencies": {
     "EntityFramework": "6.1.3",
     "EntityFramework.DynamicFilters": "1.4.8-*",
     "Migrator.EF6": "1.1.0",
     ....
   },
   "commands": {
     "ef": "Migrator.EF6"
   }
 }

现在看起来像这样:

    {
      ...
      "frameworks": {
        "net46": {
          "dependencies": {
          }
        }
      },
      "dependencies": {
        "EntityFramework": "6.1.3",
        "Microsoft.EntityFrameworkCore.SqlServer.Design": "1.0.0",
        "EntityFramework.DynamicFilters": "1.4.8-*",
        "Migrator.EF6": "1.2.0",
        "Migrator.EF6.Tools": {
          "version": "1.0.3",
          "target": "package",
          "type": "build"
        },
        ...
      },
      "tools": {
        "Migrator.EF6.Tools": {
          "version": "1.0.3",
          "imports": "portable-net45+win8+dnxcore50"
        }
      }
    }

这是我当前在 运行 'dotnet ef':

时收到的错误消息

Unhandled Exception: Microsoft.DotNet.Cli.Utils.CommandUnknownException: No executable found matching command "dotnet-ef"

您必须将此添加到您的 project.json 文件中。

"buildOptions": {
  "emitEntryPoint": true
}

此外,如果您没有 Main class,请像这样添加一个空的 Main class:

public class Program
{

    public static void Main(string[] args)
    {

    }
}