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

Entity framework 无法运行';dotnet ef';升级到.NET Core 1.0项目文件后在EF6上,entity-framework,.net-core,Entity Framework,.net Core,将所有project.json文件升级为.NET core的新格式后,我无法为Entity Framework 6迁移运行“dotnet ef”。有人能看到下面的project.json有什么问题吗 在我的project.json看起来像这样之前: { "frameworks": { "dnx46": { "dependencies": { } } }, "dependencies": { "EntityFramewor

将所有project.json文件升级为.NET core的新格式后,我无法为Entity Framework 6迁移运行“dotnet ef”。有人能看到下面的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"
        }
      }
    }
public class Program
{

    public static void Main(string[] args)
    {

    }
}
现在看起来是这样的:

{
   "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"
        }
      }
    }
public class Program
{

    public static void Main(string[] args)
    {

    }
}
这是我当前运行“dotnet ef”时收到的错误消息:

未处理的异常: Microsoft.DotNet.Cli.Utils.CommandUnknownexException:无可执行文件 找到匹配的命令“dotnet ef”


您必须将其添加到
project.json
文件中

"buildOptions": {
  "emitEntryPoint": true
}
此外,如果没有主类,请添加一个空的主类,如下所示:

{
   "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"
        }
      }
    }
public class Program
{

    public static void Main(string[] args)
    {

    }
}

好建议!加上这个后,它抱怨说没有主程序。因此,在添加一个空的主类之后,它就工作了。非常感谢。请将您的问题作为一个新问题@ZainAlabdinTawfiq提出,这样您将获得更好的反馈。对不起,请忽略,我将删除