Hi, after installing package EntityFramework I don’t have “ADO.NET Entity Data Model” under new item.
Installing NuGet package EntityFramework 6.4.4.
I know this is an old topic but for those having the same problem and finds this topic, here’s what I found:
- Using Microsoft Visual Studio Community 2019, Version 16.11.2
- Created a console project with Target Framework 5.0 (cannot use Core, you won’t get ADO at all).
- After installing EntetyFramework there was no ADO
- I downloaded and installed .NET 4.8
- Could not select .NET 4.8 in project property’s Target Framework.
- I manually edited the .csproj file: <TargetFramework>net48</TargetFramework>
- I got all the .NET versions in the project’s Target Framework, minus .NET 5.0
- I could add ADO to the project and use EF. However, I ended up with another error: Object reference not set to an instance of an object.
Hope this helps.
After a day of trying everything I think I have the definitive answer to this problem:
In the video Mosh select a “Console Application”. If you search for that you get one item but that project is a Core project (it says so in the description).
At first I did not know that EF6 cannot be used with Core projects. That’s what EntityFrameworkCore is for. Unfortunately, I couldn’t get that combination to work either: “The project’s target framework does not contain Entity Framework runtime assemblies.”. So, I quit that path as well.
To solve this you need to select “Console app (.NET Framework)” when creating your project and select .NET Framework 4.8. The rest is as described in Mosh’s video.
I think when Mosh created this course VS only supported .NET Framework and not .NET Core. I also would love to see more about EntityFrameworkCore and APIs with C#. Maybe a new course?
I learned a lot today but not necessarily things that belong to this course