efcore: Problem with dotnet cli ef tools after upgrading to vs 2017 15.4.4 and november .net core rollup

Not sure if its an EFCore issue or cli

Steps to reproduce

Using Visual Studio Enterprise 2017 (v 15.4.4)

Add migration

dotnet ef migrations add [MigrationName]

Expected behavior

Migration created

Actual behavior

Error message : 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’.

My project is a console library and the content of .csproj file is below:

<Project Sdk="Microsoft.NET.Sdk">

  <PropertyGroup>
    <TargetFramework>netcoreapp2.0</TargetFramework>
  </PropertyGroup>
  
  <ItemGroup>
    <PackageReference Include="System.Reflection.Metadata" Version="1.5.0" />
    <PackageReference Include="Microsoft.Extensions.Configuration" Version="2.0.0" />
    <PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="2.0.1" />
    <PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="2.0.1" PrivateAssets="All" />
  </ItemGroup>
  
  <ItemGroup>
    <DotNetCliToolReference Include="Microsoft.EntityFrameworkCore.Tools.DotNet" Version="2.0.1" />
  </ItemGroup>
</Project>

So i tried to use global.json in the root of my project :

{
  "sdk": {
    "version": "2.0.3"
  }
}

and the error was the same. But when I changed global.json content to this :

{
  "sdk": {
    "version": "2.0.2"
  }
}

It worked.

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Reactions: 12
  • Comments: 34 (12 by maintainers)

Most upvoted comments

I have the same predicament.

Error is occurring when running: dotnet ef migrations remove

I was able to work around this by adding this to the EF project:

<PropertyGroup>
   <TargetFramework>netcoreapp2.0</TargetFramework>
   <RuntimeFrameworkVersion>2.0.3</RuntimeFrameworkVersion>
</PropertyGroup>

Workaround

Adding the following to the project should also make it work.

<PropertyGroup>
  <GenerateRuntimeConfigurationFiles>true</GenerateRuntimeConfigurationFiles>
</PropertyGroup>

Still getting this error via Core 2.1.4 SDK within ClassLibrary. When will we be able to add EF to these using NUGET vs. manually as well?

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

dotnet ef migrations add InitialCreate 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’.

Does it not seem strange that I have to do this to get it to work on minor versions?

<PropertyGroup>
    <TargetFramework>netcoreapp2.0</TargetFramework
    <RuntimeFrameworkVersion>2.0.5</RuntimeFrameworkVersion>
</PropertyGroup>

Re-opening since it looks like there’s work to do on our side.

@cgountanis No, that’s a separate NuGet issue, tracked here: https://github.com/NuGet/Home/issues/4190

@cgountanis Unfortunately, the patch containing this fix has not yet been released. Release dates for patches is not something the EF team can influence very much, and there have been various reasons for delaying the patch release that are outside our control. I realize that this is frustrating and I apologize for that. We are, across .NET Core, working on making this process better, so hopefully it won’t be such an issue going forward.

Neither for the ‘Scaffold-DbContext’ problem in a netcoreapp2.0 project