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

此生再无相见时 提交于 2019-12-07 02:53:31

问题


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..'


回答1:


I was using version 1.1. Try to run the below command including the version number:

Visual Studio Code:

'dotnet add package Microsoft.EntityFrameworkCore.SqlServer -v 1.1.1'

Visual Studio:-

'Install-Package Microsoft.EntityFrameworkCore.SqlServer -v 1.1.1'




回答2:


In order to use version 2.0.0 of EF Core, you need the .NET Core 2.0 SDK and/or Visual Studio 2017 version 15.3.




回答3:


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.



来源:https://stackoverflow.com/questions/45703733/package-microsoft-entityframeworkcore-sqlserver-is-incompatible-with-all-fra

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!