efcore: Error creating DB migrations on 3.0.0

From @deepak-khopade-isdr on Wednesday, October 16, 2019 8:56:59 PM

Getting error creating DB migrations after upgrading to . NET Core 3.0.0

I recently updated .NET Core Framework on my linux docker containers from 1.1.0 to 3.0.0 and when trying to create migrations getting error for compatibility.

General

Running .NET Core 3.0.0 container with Ubuntu 18.04 (Linux).

Command: dotnet ef migrations add Initial

Output:

It was not possible to find any compatible framework version
The specified framework 'Microsoft.NETCore.App', version '2.0.7' was not found.
  - The following frameworks were found:
      3.0.0 at [/usr/share/dotnet/shared/Microsoft.NETCore.App]

You can resolve the problem by installing the specified framework and/or SDK.

The .NET Core frameworks can be found at:
  - https://aka.ms/dotnet-download

Platform info from 2 commands:

docker@03dda20017a9:/dotnet/app$ dotnet --version
3.0.100
docker@03dda20017a9:/dotnet/app$ dotnet --info
.NET Core SDK (reflecting any global.json):
 Version:   3.0.100
 Commit:    04339c3a26

Runtime Environment:
 OS Name:     ubuntu
 OS Version:  18.04
 OS Platform: Linux
 RID:         ubuntu.18.04-x64
 Base Path:   /usr/share/dotnet/sdk/3.0.100/

Host (useful for support):
  Version: 3.0.0
  Commit:  95a0a61858

.NET Core SDKs installed:
  3.0.100 [/usr/share/dotnet/sdk]

.NET Core runtimes installed:
  Microsoft.AspNetCore.App 3.0.0 [/usr/share/dotnet/shared/Microsoft.AspNetCore.App]
  Microsoft.NETCore.App 3.0.0 [/usr/share/dotnet/shared/Microsoft.NETCore.App]

To install additional .NET Core runtimes or SDKs:
  https://aka.ms/dotnet-download
docker@03dda20017a9:/dotnet/app$ 

Do I need to install SDK 2.0.7?

Copied from original issue: dotnet/core#3646

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Comments: 23 (9 by maintainers)

Most upvoted comments

@fergalmoran : my 2 cents on this; make sure you get .NET Core SDKs as both 2.1 and 3.0 installed alongside. And same for .NET Core runtime.

See my dotnet --info output.

.NET Core SDK (reflecting any global.json):
 Version:   3.0.100
 Commit:    04339c3a26

Runtime Environment:
 OS Name:     ubuntu
 OS Version:  18.04
 OS Platform: Linux
 RID:         ubuntu.18.04-x64
 Base Path:   /usr/share/dotnet/sdk/3.0.100/

Host (useful for support):
  Version: 3.0.0
  Commit:  95a0a61858

.NET Core SDKs installed:
  2.1.300 [/usr/share/dotnet/sdk]
  3.0.100 [/usr/share/dotnet/sdk]

.NET Core runtimes installed:
  Microsoft.AspNetCore.All 2.1.13 [/usr/share/dotnet/shared/Microsoft.AspNetCore.All]
  Microsoft.AspNetCore.App 2.1.13 [/usr/share/dotnet/shared/Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 3.0.0 [/usr/share/dotnet/shared/Microsoft.AspNetCore.App]
  Microsoft.NETCore.App 2.1.13 [/usr/share/dotnet/shared/Microsoft.NETCore.App]
  Microsoft.NETCore.App 3.0.0 [/usr/share/dotnet/shared/Microsoft.NETCore.App]

To install additional .NET Core runtimes or SDKs:
  https://aka.ms/dotnet-download

May be this too

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

@deepak-khopade-isdr The project is pulling in a mixture of 2.2 and 3.0 EF packages. This generally doesn’t work. For example, Pomelo.EntityFrameworkCore.MySql is based on EF Core 2.2. A 3.0 version is available in preview.

You should also check all your other 2.2 packages.