sdk: 'dotnet ef database update' errors when sub-minor version is not 0

Steps to reproduce

apt-get install dotnet-sdk-2.1=2.1.301-1
cd <path/to/database/proj>
dotnet ef database update

Expected behavior

Database update is run using dotnet-runtime-2.1.x (latest installed on box)

Actual behavior

dotnet falls back to 2.1.0 instead of finding 2.1.x

It was not possible to find any compatible framework version
The specified framework 'Microsoft.NETCore.App', version '2.1.0' was not found.
  - Check application dependencies and target a framework version installed at:
      /usr/share/dotnet/
  - Installing .NET Core prerequisites might help resolve this problem:
      http://go.microsoft.com/fwlink/?LinkID=798306&clcid=0x409
  - The .NET Core framework and SDK can be installed from:
      https://aka.ms/dotnet-download
  - The following versions are installed:
      2.0.5 at [/usr/share/dotnet/shared/Microsoft.NETCore.App]
      2.0.7 at [/usr/share/dotnet/shared/Microsoft.NETCore.App]
      2.1.1 at [/usr/share/dotnet/shared/Microsoft.NETCore.App]

Environment data

.NET Core SDK (reflecting any global.json):
 Version:   2.1.301
 Commit:    59524873d6

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

Host (useful for support):
  Version: 2.1.1
  Commit:  6985b9f684

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

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

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

Extra Details

This is not an issue on Windows as the dotnet installer does not clean up old versions of the runtime. apt-get will cleanup all old files contained in the older versions.

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Comments: 20 (4 by maintainers)

Most upvoted comments

@wli3 can you investigate when you get a chance?

I’m seeing this exact issue on Windows:

> dotnet ef database update
It was not possible to find any compatible framework version
The specified framework 'Microsoft.NETCore.App', version '2.1.0' was not found.
  - Check application dependencies and target a framework version installed at:
      C:\Program Files\dotnet\
  - Installing .NET Core prerequisites might help resolve this problem:
      http://go.microsoft.com/fwlink/?LinkID=798306&clcid=0x409
  - The .NET Core framework and SDK can be installed from:
      https://aka.ms/dotnet-download
  - The following versions are installed:
      2.1.1 at [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]

and --info:

> dotnet --info
.NET Core SDK (reflecting any global.json):
 Version:   2.1.301
 Commit:    59524873d6

Runtime Environment:
 OS Name:     Windows
 OS Version:  10.0.17134
 OS Platform: Windows
 RID:         win10-x64
 Base Path:   C:\Program Files\dotnet\sdk\2.1.301\

Host (useful for support):
  Version: 2.1.1
  Commit:  6985b9f684

.NET Core SDKs installed:
  2.1.301 [C:\Program Files\dotnet\sdk]

.NET Core runtimes installed:
  Microsoft.AspNetCore.All 2.1.1 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
  Microsoft.AspNetCore.App 2.1.1 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.NETCore.App 2.1.1 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]

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

As a workaround I was able to install 2.1.0 from here: https://www.microsoft.com/net/download/dotnet-core/runtime-2.1.0 and the problem went away, but I thought I’d mention it in case it’s a bigger issue.