升级到.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核心的新格式后,我无法为Entity Framework 6迁移运行dotnet ef。有人可以看到下面的project.json有什么问题吗?
After upgrading all project.json files to the new format for .NET core I cannot run 'dotnet ef' for Entity Framework 6 migrations. Can anybody see what is wrong with the project.json below?
在我的project.json看起来像这样:
Before my project.json looked like this:
{
"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':
This is the error message I currently have when I run 'dotnet ef':
未处理的异常:
Microsoft.DotNet.Cli.Utils.CommandUnknownException:无可执行文件
找到匹配命令dotnet-ef
Unhandled Exception: Microsoft.DotNet.Cli.Utils.CommandUnknownException: No executable found matching command "dotnet-ef"
推荐答案
你必须在你的 project.json
文件。
"buildOptions": {
"emitEntryPoint": true
}
另外,如果没有Main类添加这样一个空的主类:
Also, if you don't have a Main class add an empty Main class like this:
public class Program
{
public static void Main(string[] args)
{
}
}
这篇关于升级到.NET Core 1.0项目文件后,无法在EF6上运行'dotnet ef'的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!