Flores
Flores

Reputation: 8932

EF Core tools version update 2.1.1

If I run dotnet ef add testmigration

I get this warning: 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.

So I checked my csproj file:

<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>

Which looks correct to me, version 2.1.1. So I checked the docs, here

And they suggest the tools entry in the csproj needs to have this package:

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

Now a dotnet restore complains that:

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).

And dotnet ef --version still lists the old one.

So the next thing I do is remove the entry in the csproj altogether, now dotnet ef still works, but still gives me the old version.

So I figured I somehow must update the dotnet global tools for EF. But a 'dotnet tools list -g' gives me no results.

All very confusing.

Where does the old version come from, how do I get rid of it/update it?

Upvotes: 18

Views: 21234

Answers (4)

xaccor
xaccor

Reputation: 21

install-package Microsoft.EntityFrameworkCore.Tools -Version 2.1.8

did it for me

Upvotes: 2

Alper Ebicoglu
Alper Ebicoglu

Reputation: 9624

This error is also shown when you select a different project on Package Manager Console rather than the Entity Framework project in your solution.

Upvotes: 1

db2
db2

Reputation: 306

I was having this exact problem. I tried deleting bin folders and rebuilding as others have suggested but that never worked. Finally I updated the SDK to 2.1.403 and the issue was resolved.

Upvotes: 0

Flores
Flores

Reputation: 8932

Ok.

Turns out that this is caused by having the second latest sdk installed (2.1.301), but somewhere in the path a global.json pinned to version 2.1.300.

Upvotes: 3

Related Questions