stefan.stt
stefan.stt

Reputation: 2627

How to upgrade EF Core Tools

When I add-migration i got this warning:

The EF Core tools version '2.1.1-rtm-30846' is older than that of the runtime '2.1.4-rtm-31024'. Update the tools for the latest features and bug fixes.

I haven't found any information how can I update this, except with updating DotNET Core SDK, but this hasn't worked for me.

Upvotes: 63

Views: 32376

Answers (5)

Anushan Maheswaran
Anushan Maheswaran

Reputation: 1

Program.cs is missing this code:

builder.Services.AddDbContext<AppDbContext>(options =>
 options.UseSqlServer(builder.Configuration.GetConnectionString("DefaultConnection")));

Call the dbContext

Upvotes: -2

Hashim Abbas
Hashim Abbas

Reputation: 111

Issue: This issue I was getting: The Entity Framework tools version '5.0.2' is older than that of the runtime '7.0.1'. Update the tools for the latest features and bug fixes. See https://aka.ms/AAc1fbw for more information.

Tried the following solutions:

  1. installed updated dotnet ed version with dotnet tool install --global dotnet-ef --version 7.0.1 [Same error]
  2. installed the dotnet ef version with adding source dotnet tool install --global dotnet-ef --version 7.0.1 --add-source https://api.nuget.org/v3/index.json [Same error]
  3. Tried to uninstall the dotnet ef version by using dotnet tool uninstall --global dotnet-ef and then installed the 7.0.1 version using dotnet tool install --global dotnet-ef --version 7.0.1 --add-source https://api.nuget.org/v3/index.json [Same error]
  4. Also tried to ignore issues by using install -g dotnet-ef --version 5.0.2 --ignore-failed-sources [Same error]
  5. Finally the solution that helped was to remove the dotnet-ef cache and installing by using dotnet tool update --no-cache dotnet-ef --version 7.0.1 --ignore-failed-sources [The removed 5.0.2 version from cache and used 7.0.1 version of dotnet ef]

Upvotes: 2

cminus
cminus

Reputation: 1413

To piggyback on daniel-chikaka's solution, if you are still seeing the error after running the update command for the global environment.

dotnet tool update --global dotnet-ef

Try removing the --global parameter so that it updates the dotnet-tools.json file associated with the project.

dotnet tool update dotnet-ef

Upvotes: 6

Daniel Chikaka
Daniel Chikaka

Reputation: 1702

If you are using a command line ( CMD, Powershell, bash etc ) you can easily type the following to update into the latest version:

dotnet tool update --global dotnet-ef

If you want to update into a very specific version do the following:

dotnet tool update --global dotnet-ef --version VERSION_NUMBER

Example:

dotnet tool update --global dotnet-ef --version 3.1.0

Upvotes: 68

Tony Bourdeaux
Tony Bourdeaux

Reputation: 756

Update the tools using the package manager console:

Install-Package Microsoft.EntityFrameworkCore.Tools -Version 2.1.4

see this link https://www.nuget.org/packages/Microsoft.EntityFrameworkCore.Tools/

Upvotes: 74

Related Questions