Search code examples
visual-studiovisual-studio-2017

Unable to install 'Microsoft.EntityFrameworkCore' in VS 2017


I am using VS Professional 2017 Version 15.2 (26430.16) Release

I am trying install Microsoft.EntityFrameworkCore

Install-Package Microsoft.EntityFrameworkCore -Version 1.1.2

I am getting the following error

Severity Code Description Project File Line Suppression State Error Could not install package 'Microsoft.EntityFrameworkCore 1.1.2'. You are trying to install this package into a project that targets '.NETFramework,Version=v4.5', but the package does not contain any assembly references or content files that are compatible with that framework. For more information, contact the package author. 0

I googled but didn't find an answer.

I have Microsoft.Net Framework Version 4.7.02046 and Visual Studio Professional 2017 Version 15.2 (26430.16) Release


Solution

  • Your project is targetting in incompatible version of .Net Framework. Right click on the project, select properties and note the value of the Target Framework. Looking at the Nuget package for Microsoft.EntityFrameworkCore the oldest version of the .Net Framework you can target is v4.5.1.

    To use this package you need to update your project to target 4.5.1 or newer.