gpt4 book ai didi

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

转载 作者:行者123 更新时间:2023-12-03 14:40:38 25 4
gpt4 key购买 nike

如您所知,最新版本的 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/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com