Dušan Rychnovský
Dušan Rychnovský

Reputation: 12509

EF Core Cosmos 3.0.0 incompatible with .NET Core

In an ASP.NET Core (v 2.1.1) web app I'd like to use EF Core with Cosmos DB. For this I need to add the Microsoft.EntityFrameworkCore.Cosmos package.

I'm able to install the old 2.2.0-preview3-35497 NuGet.

However the current 3.0.0-preview8.19405.11 NuGet complains that

NU1202
Package Microsoft.EntityFrameworkCore.Cosmos 3.0.0-preview8.19405.11 
is not compatible with netcoreapp2.1 (.NETCoreApp,Version=v2.1).
Package Microsoft.EntityFrameworkCore.Cosmos 3.0.0-preview8.19405.11
supports: netstandard2.1 (.NETStandard,Version=v2.1)

To me the error sounds like this EF Core provider suppors only .NET and not .NET Core in the latest version.

Which is completely unexpected for an EF Core provider.

Do I understand the error correctly, why such strange change in the new version and how to fix it?

Upvotes: 2

Views: 420

Answers (1)

VINICIUS LIMA
VINICIUS LIMA

Reputation: 21

This error is because .Net Core 3.0 look to .net standard 2.1 (not disponible officially). But, Visual Studio is already compatible.

Open your .csproj and edit TargetFramework tag to "netstandard2.1": <TargetFramework>netstandard2.1</TargetFramework>

Make it to all projects and probably works ;p

Upvotes: 2

Related Questions