visual-studio - EF Core 数据库优先的 "No executable found matching command dotnet-ef"错误

标签 visual-studio entity-framework dbcontext database-first

如您所知,最新版本的 Visual Studio 2017 放弃了“project.json”并使用 .csproj反而。

我正在使用 RTM 版本并希望从现有数据库生成模型,遵循 this guide .我在最后一步遇到错误:

The Entity Framework Core commands for the Package Manager Console don't yet support csproj-based .NET Core projects. Use the .NET Command Line Tools (i.e. dotnet ef) instead. For more details, see https://go.microsoft.com/fwlink/?linkid=834381.



在错误之后,我使用它提到的链接切换到 dotnet ef .这是我的包管理器命令:

PM> dotnet ef dbcontext scaffold "Server=.;Database=Jumpstart;Trusted_Connection=True;" Microsoft.EntityFrameworkCore.SqlServer



然后错误又来了:

dotnet : No executable found matching command "dotnet-ef"



我用了help命令,发现dotnet没有一个叫ef的命令。

我只想从现有数据库生成模型。

最佳答案

按照本教程

https://docs.microsoft.com/en-us/aspnet/core/data/ef-mvc/migrations

我有同样的问题。刚刚编辑了 中的 ItemGroup 部分.csproj 像这样

<ItemGroup>
   <DotNetCliToolReference Include="Microsoft.EntityFrameworkCore.Tools.DotNet" Version="1.0.0" />
</ItemGroup>

关于visual-studio - EF Core 数据库优先的 "No executable found matching command dotnet-ef"错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42898188/

相关文章:

c# - 如何在旧版本的 Windows 10 上测试应用程序?

c# - 更改值适用于预加载但不适用于 linq 和 ef 中的惰性加载

visual-studio-2010 - 如何解决 Visual Studio 2010 和 Visual Studio 2012 之间的冲突

sql-server - Visual Studio团队在线服务-运行sql脚本

根据属性名称的 C# Linq where 子句

c# - 如何在 Entity Framework 中使用动态 DbSet?

asp.net-core - ASP .NET Entity Framework Core 无法访问已释放的对象

mysql - 使用多个dbcontexts并且找不到原始数据库

c# - 'Microsoft.EntityFrameworkCore.Infrastructure.IDbContextFactory`1[TContext ]' violates the constraint of type parameter ' TContext'

C# 查看特定 .NET 类的源代码