EF Core 工具版本 '3.1.2' 的版本早于运行时"3.1.7"的版本。更新工具以获取最新功能和错误修复


PM> update-database
Build started...
Build succeeded.
The EF Core tools version '3.1.2' is older than that of the runtime '3.1.7'. Update the tools for the latest features and bug fixes.

我尝试了本地更新。因为不同的项目可能在同一台机器上使用不同的版本。

如果我做这个

$ dotnet tool update dotnet-ef

我收到这个错误找不到清单文件。

这是我的版本号:

$ dotnet ef --version
Entity Framework Core .NET Command-line Tools
3.1.5

UPDATE事实证明,这是一个有很多方面的问题。主要问题是Visual Studio:https://developercommunity.visualstudio.com/content/problem/438312/vs-2019-preview2-after-saving-edmx-code-is-not-gen.html


请尝试

dotnet tool update --global dotnet-ef

并重新启动Visual Studio

将较新的工具与旧版本的EF一起使用应该不会有任何危害。您将获得工具的错误修复和功能,这些功能应该都是向后兼容的。除非您使用不同的主要版本(2.x和3.x(,否则我认为在这种情况下,--global是安装/更新该工具的正确方式。

否则,您需要在项目中有一个.config/dotnet-tools.json文件(或其上方的某个目录(。这是错误所说的丢失的清单文件。你可以用dotnet new tool-manifest创建一个新的,但你必须自己编辑:

{
"version": "1",
"isRoot": true,
"tools": {
"dotnet-ef": {
"version": "3.1.7",
"commands": ["dotnet-ef"],
}
}
}

完成后,您需要运行dotnet tool restore以在本地恢复和安装该工具。关于清单文件的更多信息可以在这里找到。关于dotnet-ef,请参见此处。

我不确定,但相当肯定的是,如果您尝试在本地安装该工具,它应该创建清单,并在不存在的情况下添加必要的信息。您可能只需要尝试在项目目录中运行dotnet tool install dotnet-ef(而不是update(。

它仍然在抱怨,并指定对我有效的版本:

dotnet工具更新--全局dotnet ef--版本x.x.x

最新更新