Nishant Bangera
Nishant Bangera

Reputation: 174

Adding Entity Framework Model on Visual Studio 2022

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

Upvotes: 10

Views: 41611

Answers (3)

Hossein
Hossein

Reputation: 3113

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

Upvotes: 2

Krishna Nekkala
Krishna Nekkala

Reputation: 301

Ensure you have Target Framework as show.

enter image description here

Upvotes: 2

Nishant Bangera
Nishant Bangera

Reputation: 174

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.

Upvotes: 3

Related Questions