Adding Entity Framework Model on Visual Studio 2022

Viewed 11323

I am using Visual Studio 2022 with.Net 6.0, I installed Entity Framework 6.4.4 after adding it when I create an Entity Framework model. I am getting a Popup message saying that.

The project's target framework does not contain Entity Framework runtime assemblies. Please review the target framework information on the project's property page.

Can somebody tell us how to solve that problem? enter image description here

3 Answers

You can install .Net Framework 4.8.

.Net Core 1 - 3.2 & .Net 5 & 6 has no Entity Framework Data Model available with EF Core.

You want to use EF 6 (not Core) and Data Model you have to use .Net Framework 4.8 or lower than that.

Ensure you have Target Framework as show.

enter image description here

Try this to generate/update entire DbContext and models:

Scaffold-DbContext -Connection "Server=(local);Database=DefenderRRCart;Integrated Security=True;Trusted_Connection=True;" -Provider Microsoft.EntityFrameworkCore.SqlServer -OutputDir RRStoreContext.Models -context RRStoreContext -Project RR.DataAccess -force

See this post for more info. https://stackoverflow.com/a/41413291/4588756

Related