更新.NET Core工具

彼得特让

我正在尝试使用[email protected]为了做到这一点,我已经拥有:-安装了Visual Studio 2019 Preview-安装了.NET Core 3.1运行时-安装了.NET Core 3.1 SDK

现在我仍然无法运行命令dotnet ef migrations add xxx就是说我必须更新dotnet工具。因此,我在管理员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')

好的,不包括预览版本。因此,我尝试明确指定版本:

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 https://aka.ms/failure-installing-tool

现在说.NET Core 3.1工具与.NET Core 3.1运行时不兼容。

但是,如果我执行简单的版本检查:

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(我的项目中安装了哪个工具版本)。

我还缺少什么还是这是一个错误?

thinkOfaNumber

感谢@ lars-haupt-hansen向我指出该错误,我遵循PR踪迹,该PR显示它已合并到“ aspnet:release / 3.1”中。最新的3.1仍然是预览版(preview3) [编辑:它不在预览中]。您可以在此处找到并下载最新的SDK

要在Visual Studio项目中使用它,您必须

  1. 从上面的链接安装SDK;
  2. 转到工具>选项>环境>预览功能,然后启用“使用.NET Core SDK的预览”;(不再需要3.1)
  3. 重新启动VS (3.1不再需要)
  4. 转到每个项目属性,然后可以选择目标框架 .NET Core 3.1

然后,要通过命令行安装EF Core,请dotnet tool install --global dotnet-ef从您的项目目录中运行

本文收集自互联网,转载请注明来源。

如有侵权,请联系 [email protected] 删除。

编辑于
0

我来说两句

0 条评论
登录 后参与评论

相关文章