简体   繁体   中英

How can I solve installation error package?

I create a Class Library on visual studio, I want to install Microsoft.EntityFrameworkCore but I have this error:

Could not install package 'Microsoft.EntityFrameworkCore 3.0.0'. You are trying to install this package into a project that targets '.NETFramework,Version=v4.6.1', 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.

I already check my target framework and nuget version. I just wanted to create a DbContext in my project in order to communicate with my database.

public class ContextLM: DbContext
{
    public ContextLM() :base(nameOrConnectionString: "ContextLM") { }
    public virtual DbSet<Customer> Customer { get; set; }
}

You are inside a.Net Framework project, not a.Net Core project. You should download Entity Framework 6 from nuget instead of EF Core to solve the problem.

Or if you want change project type to a.Net Core project if you have to use EF Core

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM