4
votes

Currently Microsoft.EntityFrameworkCore.Tools.DotNet V2.0.1 is showing a dependency of .NetCoreApp Version = 2.0

Any reason why that isnt version >=2.0 ?
Any idea when support for the more recent versions of .NetCore SDK will be available

EDIT: Added screenshot Nuget in VS 2017
See dependency listed as .NetCoreApp = v2.0 and not .NetStandard = V2.0 or >= CoreApp V2.0 for similar packages.

edit2:
I ran the following new Project tests: i still think there is an issue here.
I have .netcore sdk 2.1.4 installed I started with brand new solution in VS2017 15.5.5

I create a new core project netcoreapp2.0 and a new standard project netstandard2.0

These packages

o Microsoft.EntityFrameworkCore.tools v2.0.1
o Microsoft.EntityFrameworkCore.design v2.0.1
o Microsoft.EntityFrameworkCore v2.0.1
o Microsoft.EntityFrameworkCore.Sqlite

can all be successfully installed in both projects netstandard2.0 and netcoreapp2.0

However: Microsoft.EntityFrameworkCore.Tools.DotNet v2.0.1 can not be installed in netstandard2.0 project, which I can live with and the error makes some sense.

Restoring packages for C:_Dev\PJSTest\PJSStd\PJSStd.csproj... Package Microsoft.EntityFrameworkCore.Tools.DotNet 2.0.1 is not compatible with netstandard2.0 (.NETStandard,Version=v2.0). Package Microsoft.EntityFrameworkCore.Tools.DotNet 2.0.1 supports: netcoreapp2.0 (.NETCoreApp,Version=v2.0) Package restore failed. Rolling back package changes for 'PJSStd'. Time Elapsed: 00:00:00.1634807 ========== Finished ==========

BUT

Microsoft.EntityFrameworkCore.Tools.DotNet v2.0.1

can not be even be installed in a netcoreapp2.0 project

Restoring packages for C:_Dev\EFTEST\EFCore\EFCore.csproj... Detected package downgrade: Microsoft.NETCore.App from 2.0.3 to 2.0.0. Reference the package directly from the project to select a different version. EFCore -> Microsoft.EntityFrameworkCore.Tools.DotNet 2.0.1 -> Microsoft.NETCore.App (>= 2.0.3) EFCore -> Microsoft.NETCore.App (>= 2.0.0) Package restore failed. Rolling back package changes for 'EFCore'. Time Elapsed: 00:00:01.1413809 ========== Finished ==========

I think there is an issue with versioning on the CoreApp dependency.

1
Where are you seeing that dependency version? Looks like it needs >= 2.0.3 to meDavidG
If you manually add the following to your new test csproj file (in an <ItemGroup>), do you get the same error? <DotNetCliToolReference Include="Microsoft.EntityFrameworkCore.Tools.DotNet" Version="2.0.1" />Balah

1 Answers

3
votes

I'm happy to be corrected, but my understanding is that .NetCoreApp (v2) is the platform, whereas .NetCore.App (v2.0.5, currently) is the set of API's that target that platform.

So the fact that Microsoft.EntityFrameworkCore.Tools.DotNet V2.0.1 only points to .NetCoreApp,Version = 2.0 means it can only support the apis from that platform... which says nothing about what platforms those dependencies support. e.g. you if you take a further and look inside at the Microsoft.NetCore.App dependencies, you will see listings under .NetCoreApp,Version = 1.0 up to 2.0.

EDIT: My understanding of various .NET core versioning landscape goes as follows:

  1. The .NET Core SDK version is 2.1.5. This allows the building of .NET standard and .NET core apps.
  2. The Microsoft.EntityFrameworkCore.Tools.DotNet version is 2.0.1. This references .netcoreapp2.0
  3. .netcoreapp2.0 is the platform that implements Microsoft.NetCore.App, which is currently version 2.0.5 of the runtime.

The key part of netcoreapp2.0 is its dependence on .NETStandard.Library (netstandard2.0) but netstandard2.0 does not depend on netcoreapp2.0. I think this answer explains it better than I can. So the EntityFramework cli tools won't work on a library that uses .netstandard2.0 because it targets .netcoreapp2.0. Incidentally, EFCore does work - because it targets .netstandard - just the tools won't.

In summary, the SDK that you have, at version 2.1.4, already contains the necessary .NET Core platforms and runtimes. So no downgrade to the original version 2 is required. What needs to happen is that the csproj has to be updated to target the .NET Core runtime instead in order to use the tools: <TargetFramework>netcoreapp2.0</TargetFramework>.

EDIT2: Here's a sample of a csproj file that targets .netstandard (so that UWP can reference it), and is able to use the EFCore tools.DotNet:

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

  <PropertyGroup>
    <TargetFramework>netstandard2.0</TargetFramework>
  </PropertyGroup>

  <ItemGroup>
    <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>

The Microsoft.EntityFrameworkCore.Tools is a package reference that targets .NET Standard. the Microsoft.EntityFrameworkCore.Tools.DotNet is a tools reference and is treated differently to package references. So the versioning and targets are also a little different.