将所有project.json文件升级到.NET核心的新格式后,我无法运行“dotnet ef' for 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'”时出现的错误消息:
未处理的例外情况: Microsoft.DotNet.Cli.Utils.CommandUnknownException:没有可执行文件 找到匹配的命令" dotnet-ef"
答案 0 :(得分:3)
您必须在"buildOptions": {
"emitEntryPoint": true
}
文件中添加此内容。
public class Program
{
public static void Main(string[] args)
{
}
}
此外,如果您没有Main类,请添加一个空的Main类:
Accesory Action