我正在尝试使用 EntityFrameworkCore@3.1.为了在这一点上做到这一点,我已经有了:- 已安装 Visual Studio 2019 预览版- 安装了 .NET Core 3.1 运行时- 安装了 .NET Core 3.1 SDK
I'm trying to use EntityFrameworkCore@3.1. In order to do this at this point I already have: - Installed Visual Studio 2019 Preview - Installed the .NET Core 3.1 Runtime - Installed the .NET Core 3.1 SDK
现在我仍然无法运行命令dotnet ef migrations add xxx.据说我必须更新 dotnet 工具.所以我在管理员 powershell 中运行以下命令:
Now I still can't run the command dotnet ef migrations add xxx. It's saying that I have to update the dotnet tools. So I run the following command in an administrator powershell:
PS C:\WINDOWS\system32> dotnet tool update --global dotnet-ef Tool 'dotnet-ef' was reinstalled with the latest stable version (version '3.0.0')好的,不包括预览版本.所以我尝试明确指定版本:
Okay, not including the preview versions. So I try to specify the version explicitly:
PS C:\WINDOWS\system32> dotnet tool update --global dotnet-ef --version="3.1.0-preview1.19506.2" error NU1202: Package dotnet-ef 3.1.0-preview1.19506.2 is not compatible with netcoreapp3.1 (.NETCoreApp,Version=v3.1) / any. Package dotnet-ef 3.1.0-preview1.19506.2 supports: netcoreapp3.1 (.NETCoreApp,Version=v3.1) Tool 'dotnet-ef' failed to update due to the following: The tool package could not be restored. Tool 'dotnet-ef' failed to install. This failure may have been caused by: * You are attempting to install a preview release and did not use the --version option to specify the version. * A package by this name was found, but it was not a .NET Core tool. * The required NuGet feed cannot be accessed, perhaps because of an Internet connection problem. * You mistyped the name of the tool. For more reasons, including package naming enforcement, visit aka.ms/failure-installing-tool现在有人说 .NET Core 3.1 工具与 .NET Core 3.1 运行时不兼容.
Now it's saying that a .NET Core 3.1 tool is not compatible with the .NET Core 3.1 runtime.
但是,如果我做一个简单的版本检查:
However, if I do a simple version check:
PS C:\WINDOWS\system32> dotnet --version 3.1.100-preview1-014459 PS C:\WINDOWS\system32> dotnet ef --version Entity Framework Core .NET Command-line Tools 3.0.0我可以看到 EntityFrameworkCore.Tools 仍然是 3.0.0 版本而不是 3.1.0(我的项目中安装了哪个工具版本).
I can see that the EntityFrameworkCore.Tools is still at version 3.0.0 instead of 3.1.0 (which tools version is installed in my project).
我还遗漏了什么还是这是一个错误?
Am I still missing something or is this a bug?
推荐答案感谢 @lars-haupt-hansen 指出错误,我 遵循跟踪到 PR 显示它已合并到aspnet:release/3.1".最新的 3.1 仍然是预览 (preview3) .您可以在此处找到并下载最新的 SDK.
Thanks to @lars-haupt-hansen for pointing me to the bug, I followed the trail to the PR which shows it was merged into "aspnet:release/3.1". The latest 3.1 is still a preview (preview3) [edit: it's out of preview]. You can find and download the latest SDK here.
要在 Visual Studio 项目中使用它,您必须
To use it in Visual Studio projects, you have to
然后要通过命令行安装 EF Core,请从项目目录运行 dotnet tool install --global dotnet-ef.
Then to install EF Core via the command line, run dotnet tool install --global dotnet-ef from your project directory.
更多推荐
更新 .NET Core 工具
发布评论