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

编程入门 行业动态 更新时间:2024-10-21 22:55:11
本文介绍了升级到.NET Core 1.0项目文件后,无法在EF6上运行'dotnet ef'的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

将所有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'

本文发布于:2023-11-14 04:31:23,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1586225.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:升级到   文件   项目   Core   NET

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!