My project builds without any issues and can run without issues, but I cannot use dotnet ef migrations
because of this strange error:
The specified framework version '2.0' could not be parsed
The specified framework 'Microsoft.NETCore.App', version '2.0' was not found.
- Check application dependencies and target a framework version installed at:
/
- Alternatively, install the framework version '2.0'.
I have latest dotnet tooling installed - SDK 2.1.4 and runtime 2.0.5.
Can anyone help with that? I was trying to find any solutions on web but didn't find anything working...
I finally found the answer after going through some issues on GitHub.
It looks like it is an issue with dotnet CLI itself, not EF core.
If you are facing this issue, please update your .csproj
file to include runtime framework version:
(at the time of writing this post I have 2.0.5
installed, but check which version you have and use correct one which you have on your machine.
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netcoreapp2.0</TargetFramework>
<RuntimeFrameworkVersion>2.0.5</RuntimeFrameworkVersion>
</PropertyGroup>
It solves the issue properly. To me it looks like without specified version in csproj
file, dotnet CLI is trying to fall back to 2.0.0 which most of us don't have on computers because of the updates.
There can also be another issue. If you are missing the Microsoft.EntityFrameworkCore.Design NuGet package, you will get the same error. So make sure you have this NuGet package referenced from the project where you want to run migrations.
Adding this to the .csproj
file solved it for me, following this thread on Github:
<PropertyGroup>
<GenerateRuntimeConfigurationFiles>true</GenerateRuntimeConfigurationFiles>
</PropertyGroup>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With