0

I want to add Entity Framework to my project. I click add, add new item, and then select ado.net entity data model. When I finish the progress, I get this error:

Object reference not set to an instance of an object

enter image description here

I searched a lot but I can't seem to find a solution. (I tested this in VS 2019 and it was OK)

I try this with a console project, Windows Forms app, with different databases but it still have this problem.

I'm looking for a way to solve this problem

Amira Bedhiafi
  • 8,088
  • 6
  • 24
  • 60
Sina
  • 1
  • Most likely you are targeting .NET Core (including .NET 5 and later) rather than .NET Framework. To target .NET Framework, you need to select a project template that specifically says ".NET Framework". If you target .NET Core then you need to use EF Core and I don't think that wizard supports it. In that case, you'd need to use EF Core, so you should read up on how to do that. For simplicity, a new project might be the best option but .NET Core is the preferred option these days and the only stream being actively developed. – jmcilhinney Jul 10 '23 at 06:44
  • Are you running the latest VS version? – ErikEJ Jul 10 '23 at 06:47
  • 1
    For the record, the latest version is 17.6.4. That said, that data source wizard is pretty old and I'd be surprised if any changes are being made to it now. It's not impossible that it has been affected by something else though. – jmcilhinney Jul 10 '23 at 07:23

0 Answers0