Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?

like image 762
Flores Avatar asked Jul 11 '18 12:07

Flores


People also ask

How do I update ef core tools?

Update the tools Use dotnet tool update --global dotnet-ef to update the global tools to the latest available version. If you have the tools installed locally in your project use dotnet tool update dotnet-ef . Install a specific version by appending --version <VERSION> to your command.

What is the latest version of ef core?

The most recent Entity Framework Core 6.0 (EF Core 6) was released on 10 November 2021.

How do I find my ef core version?

Popular Answer. Another way to get the EF version you are using is to open the Package Manager Console (PMC) in Visual Studio and type Get-Package at the prompt. The first line with be for EntityFramework and list the version the project has installed.

What is the difference between EF Core and EF Core Tools?

When the EF Core model is in a project that targets .NET Core or .NET Framework, the EF Core tools borrow the runtime from the project. They can't do that if the EF Core model is in a .NET Standard class library.

Which runtime version is older than the runtime version of EF?

Bookmark this question. Show activity on this post. The EF Core tools version '2.1.1-rtm-30846' is older than that of the runtime '2.1.4-rtm-31024'.

What are the CLI tools for Entity Framework Core?

The command-line interface (CLI) tools for Entity Framework Core perform design-time development tasks. For example, they create migrations, apply migrations, and generate code for a model based on an existing database. The commands are an extension to the cross-platform dotnet command, which is part of the.NET Core SDK.

How do I install DotNet EF?

dotnet ef can be installed as either a global or local tool. Most developers prefer installing dotnet ef as a global tool using the following command: dotnet tool install --global dotnet-ef To use it as a local tool, restore the dependencies of a project that declares it as a tooling dependency using a tool manifest file.


2 Answers

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.

like image 57
Flores Avatar answered Oct 25 '22 07:10

Flores


install-package Microsoft.EntityFrameworkCore.Tools -Version 2.1.8

did it for me

like image 42
xaccor Avatar answered Oct 25 '22 07:10

xaccor