question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

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

See original GitHub issue

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.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:20 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
peterhuenecommented, Jul 3, 2018

@wli3 can you investigate when you get a chance?

1reaction
lpricharcommented, Jul 3, 2018

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.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Error running update-database entityframeworkcore 2
WebApi\bin\Debug\netcoreapp2.0\ef.xml'. I have tried cleaning the project, re-compiling (there are no errors), I have also ...
Read more >
Cant Update dataBase after Adding a new Migration In EF ...
My class is public class Ittracker { [Required] [RegularExpression("([a-zA-Z][a-zA-Z ]+)", ErrorMessage = "Only alphabets are allowed")] ...
Read more >
Troubleshooting the dotnet ef command for EF Core ...
The most common one is. No executable found matching command "dotnet-ef" ... After March 7 release, this will just be version “1.0.0”.
Read more >
How to Solve the Command or File Was Not Found EF ...
In this article, we are going to learn how to solve the Command or File Was Not Found EF Core migration error.
Read more >
How to fix EF Core Update Database Migration issue in VS 2022
Unlock the power of Microsoft . NET Core with my engaging Udemy courses! For all the details and limited-time $9.99 pricing, scroll down...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found