Mar*_*ert 32 entity-framework-core
当我在VS 2017包管理器控制台中使用dotnet ef工具时,我收到有关需要更新EF Core工具的警告消息:
PM> dotnet ef migrations list -s ../RideMonitorSite
The EF Core tools version '2.1.1-rtm-30846' is older than that of the runtime '2.1.2-rtm-30932'. Update the tools for the latest features and bug fixes.
20180831043252_Initial
Run Code Online (Sandbox Code Playgroud)
但是我的csproj文件有这个条目:
<ItemGroup>
<DotNetCliToolReference Include="Microsoft.EntityFrameworkCore.Tools.DotNet" Version="2.1.2" />
</ItemGroup>
Run Code Online (Sandbox Code Playgroud)
我已经确认安装的版本实际上是过时的:
PM> dotnet ef --version
Entity Framework Core .NET Command-line Tools
2.1.1-rtm-30846
Run Code Online (Sandbox Code Playgroud)
那么我该如何更新工具呢?顺便说一下,我在其他答案中看到过时的global.json文件会导致这个问题.但我在解决方案的任何地方都没有global.json文件.
Mar*_*tin 426
针对特定版本使用命令行、Cmd或PowerShell:
dotnet tool update --global dotnet-ef --version 3.1.0
或用于最新版本(也适用于重新安装):
dotnet tool update --global dotnet-ef
uno*_*aii 27
对于.NET 6,这将是
dotnet tool update --global dotnet-ef --version 6.0.0
Run Code Online (Sandbox Code Playgroud)
对我有用的解决方案在程序包管理器控制台中运行以下命令:
PM> Install-Package Microsoft.EntityFrameworkCore -Version 2.1.11
PM> Install-Package Microsoft.EntityFrameworkCore.Tools -Version 2.1.11
Run Code Online (Sandbox Code Playgroud)
如果我遇到以下错误,请确保版本与错误消息中的版本匹配:
The EF Core tools version '2.1.1-rtm-30846' is older than that of the runtime '2.1.11-servicing-32099'. Update the tools for the latest features and bug fixes.
Run Code Online (Sandbox Code Playgroud)
检查可从以下站点获得的版本:https : //www.nuget.org/packages/Microsoft.EntityFrameworkCore/
试试这个: Install-Package Microsoft.EntityFrameworkCore.Tools
如果仍然出现问题,请同时执行以下操作: Update-Package Microsoft.EntityFrameworkCore.Tools
我的解决方案是从微软https://www.nuget.org/packages/dotnet-ef安装工具 dotnet-ef。它使用相同的命令但没有警告。更改是使用 dotnet-ef 而不是 dotnet ef。
如果您已经安装了 dotnet-ef,则使用
dotnet tool update --global dotnet-ef --version n.n.n(nnn 您要更新的版本)
| 归档时间: |
|
| 查看次数: |
20027 次 |
| 最近记录: |