EF Core tools version update 2.1.1

Flores picture Flores · Jul 11, 2018 · Viewed 19.4k times · Source

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?

Answer

Flores picture Flores · Jul 11, 2018

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.