For anyone who might be interested : I just discovered VS 2019 Community (which I was using) does not support .Net 6.0.
I installed VS 2022 Community and now I can use Entity Framework Core 7.0.
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
I want to write a simple Desktop WinForms application using Entity Framework to access Data .
My project file's contante is as follows :
<Project Sdk="Microsoft.NET.Sdk.WindowsDesktop">
<PropertyGroup>
<OutputType>WinExe</OutputType>
<TargetFramework>netcoreapp3.1</TargetFramework>
<UseWindowsForms>true</UseWindowsForms>
</PropertyGroup>
</Project>
I tried installing from Nuget every possible version of EF but noone is compatible with netcoreapp 3.1
What should I do to use EF ? and moreover, is it possible to use it on netcore 3.1 ?
For anyone who might be interested : I just discovered VS 2019 Community (which I was using) does not support .Net 6.0.
I installed VS 2022 Community and now I can use Entity Framework Core 7.0.
Always do you select the same nuget package than your version framework.
In my case i have net 5.0 framework and i selected only nuget library in 5.X.X (RED)
In your case you must selected only 3.x.x Or update your framework to 7.XXX and install nuget in 7.XX (Green)
@leo del ciello , Welcome to Microsoft Q&A, We need to make sure that we used .net 6.0 version when we want to use EF core in .NET Core app.
Please refer to the following steps to use ef core in winform app.
First. Please install .NET 6.0 from the following link:
https://dotnet.microsoft.com/en-us/download/dotnet/6.0
Second. Please change your project file into the following:
<Project Sdk="Microsoft.NET.Sdk.WindowsDesktop">
<PropertyGroup>
<OutputType>WinExe</OutputType>
<TargetFramework>net6.0-windows</TargetFramework>
<UseWindowsForms>true</UseWindowsForms>
</PropertyGroup>
</Project>
Third, Please install the latest version nuget package like the following:
Microsoft.EntityFrameworkCore
Finally, you could use ef core in your winform project.
Best regards,
Jack
If the answer is the right solution, please click "Accept Answer" and upvote it.If you have extra questions about this answer, please click "Comment".
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.