Package 'Microsoft.EntityFrameworkCore.SqlServer' is incompatible with 'all' frameworks in the project

Viewed 14752

I was trying to add the package named Microsoft.EntityFrameworkCore.SqlServer by running the command.

dotnet add package Microsoft.EntityFrameworkCore.SqlServer

in Visual Studio Code, but I get this error:

Package Microsoft.EntityFrameworkCore.SqlServer 2.0.0 is not compatible with netcoreapp1.1 (.NETCoreApp,Version=v1.1). Package Microsoft.EntityFrameworkCore.SqlServer 2.0.0 supports: netstandard2.0" (.NETStandard,Version=v2.0). Package 'Microsoft.EntityFrameworkCore.SqlServer' is incompatible with 'all' frameworks in project 'C:\users\username..'

5 Answers

This Might Be Happening due to generated NuGet Cache While Installing Packages. Go to Tools>Options>NuGet Package Manager>General and "Clear All NuGet Cache". This Worked in my case(VS Community 2019).

Also try to update Source of nuget.org by going to Tools>Options>NuGet Package Manager>Package Source and click Update Source in case of VS 2017.

In case I had a similar issue with the same error message.

I cloned a project which was using netcoreapp2.1 and my version was 2.2.

I updated the TargetFramework (*.csproj) to netcoreapp2.2. Then, I was able to install the package.

Install the SDK required (eg: dotnet-sdk-5.0.203-win-x64.exe).delete obj and bin folders. Rebuild the project. This worked for me.

Related