简体   繁体   中英

dotnet ef migrations issue in Ubuntu 19.10. Dotnet sdk 3.1.1

I installed dotnet ef tool in order to generate migrations for a dotnet core project am working on using the command. dotnet tool install -g dotnet-ef . The installation was successfull. In order to us dotnet ef i have installed the nuget packages below

  1. Microsoft.EntityFrameworkCore.SqlServer
  2. Microsoft.EntityFrameworkCore
  3. Microsoft.AspNetCore.Identity.EntityFrameworkCore
  4. Microsoft.EntityFrameworkCore.Tools

When trying to generate migrations using the command dotnet ef migrations add IdentityandCategory i get the output below.

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

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

The specified framework can be found at:
  - https://aka.ms/dotnet-core-applaunch?framework=Microsoft.NETCore.App&framework_version=3.1.1&arch=x64&rid=ubuntu.19.10-x64

I reinstall dotnet 3.1.1 but this trouble continues. dotnet info seem to detect the version when i run donet --info

.NET Core SDK (reflecting any global.json):
 Version:   3.1.100
 Commit:    cd82f021f4

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

Host (useful for support):
  Version: 3.1.0
  Commit:  157910edee

.NET Core SDKs installed:
  2.1.802 [/usr/share/dotnet/sdk]
  2.2.402 [/usr/share/dotnet/sdk]
  3.1.100 [/usr/share/dotnet/sdk]

.NET Core runtimes installed:
  Microsoft.AspNetCore.All 2.1.14 [/usr/share/dotnet/shared/Microsoft.AspNetCore.All]
  Microsoft.AspNetCore.All 2.2.8 [/usr/share/dotnet/shared/Microsoft.AspNetCore.All]
  Microsoft.AspNetCore.App 2.1.14 [/usr/share/dotnet/shared/Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 2.2.8 [/usr/share/dotnet/shared/Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 3.1.0 [/usr/share/dotnet/shared/Microsoft.AspNetCore.App]
  Microsoft.NETCore.App 2.1.14 [/usr/share/dotnet/shared/Microsoft.NETCore.App]
  Microsoft.NETCore.App 2.2.8 [/usr/share/dotnet/shared/Microsoft.NETCore.App]
  Microsoft.NETCore.App 3.1.0 [/usr/share/dotnet/shared/Microsoft.NETCore.App]

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

How can i solve this issues? Thank in advance for your help

I ran into this issue today on Azure Pipelines. The easiest way to fix it is to explicitly install dotnet-ef by specifying the exact version you need.

dotnet tool install --global dotnet-ef --version 3.1.0

I believe that the .NET Core Runtime version and the dotnet-ef version have to be in sync. Since there was a security patch released recently that bumped .NET Core Runtime up to 3.1.1 , there is a mismatch and that is why it is complaining.

That said, it is probably wise to just update everything to 3.1.1 when time permits.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM