EF Core工具版本更新2.1.1

时间:2018-07-11 12:01:09

标签: entity-framework .net-core ef-core-2.1

如果我运行dotnet ef add testmigration

我收到此警告:The EF Core tools version '2.1.0-rtm-30799' is older than that of the runtime '2.1.1-rtm-30846'. Update the tools for the latest features and bug fixes.

所以我检查了我的csproj文件:

<ItemGroup>
    <PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="2.1.1" />
    <PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="2.1.1" />
    <PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="2.1.1" />
    <PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="2.1.1" />
</ItemGroup>

对我而言,版本2.1.1看起来正确。 所以我检查了文档here

并且他们建议csproj中的工具条目需要具有以下软件包:

<ItemGroup>
    <DotNetCliToolReference Include="Microsoft.EntityFrameworkCore.Tools.DotNet" Version="2.1.1" />
</ItemGroup>

现在dotnet restore抱怨:

warning : The tool 'Microsoft.EntityFrameworkCore.Tools.DotNet' is now included in the .NET Core SDK. Information on resolving this warning is available at (https://aka.ms/dotnetclitools-in-box).

dotnet ef --version仍然列出了旧版本。

因此,我下一步要做的是完全删除csproj中的条目,现在dotnet ef仍然可以使用,但是仍然提供旧版本。

所以我认为我必须以某种方式更新EF的dotnet全局工具。但是“ dotnet工具列表-g”没有任何结果。

一切都很混乱。

旧版本来自哪里,如何删除/更新?

4 个答案:

答案 0 :(得分:3)

好的。

事实证明,这是由于安装了第二个最新的sdk(2.1.301)导致的,但是它是在路径中某个位置将global.json固定到2.1.300版的。

答案 1 :(得分:1)

install-package Microsoft.EntityFrameworkCore.Tools -Version 2.1.8

为我做了

答案 2 :(得分:0)

我遇到了这个确切的问题。我曾尝试删除bin文件夹并按照其他人的建议进行重建,但是那一直没用。最后,我将SDK更新为2.1.403,问题得以解决。

答案 3 :(得分:0)

当您在 Package Manager控制台中选择其他项目,而不是解决方案中的Entity Framework项目时,也会显示此错误。

相关问题