net472 to net8.0 migration

Sowmya Golla 0 Reputation points Microsoft Employee
2025-04-23T17:04:03.97+00:00

Hi Team, I am trying to migrate my project with n-tier architecture from .net framework 4.7.2 to .NET 8.0. We are using Entity Framework 6.5.1 and Microsoft.EntityFramework.SqlServer 6.5.1 in shared library [projects, How can i migrate them, tried net472 and netstandard2.1 as multitargeting but getting varoious issues with compatibility with other projects and System.ServiceModel and Entity Framework are not being compatible. What would be the best suggestion we are not planning on migrating to entityframeworkcore as it would be way too many changes in migration

ASP.NET Core Training
ASP.NET Core Training
ASP.NET Core: A set of technologies in the .NET Framework for building web applications and XML web services.Training: Instruction to develop new skills.
62 questions
0 comments No comments
{count} votes

2 answers

Sort by: Most helpful
  1. Pradeep M 8,185 Reputation points Microsoft External Staff
    2025-04-24T03:53:21.7333333+00:00

    Hi Sowmya Golla,

    Thank you for reaching out to Microsoft Q & A forum. 

    To migrate from .NET Framework 4.7.2 to .NET 8.0 with Entity Framework 6.x, consider the following options: 

    1.Maintain EF 6.x in .NET Framework: You can continue using Entity Framework 6.x within the .NET Framework for the data layer while migrating the rest of the application to .NET 8.0. This may involve using inter-process communication (IPC) or adopting a service-based architecture. 

    2.Target .NET Standard: Another option is to retarget your EF 6.x projects to .NET Standard 2.0. However, this might not be fully compatible with .NET 6/7/8, so it could limit your future migration options. 

    3.Use a Separate Service Layer: Consider isolating the EF 6.x logic into a separate service or API, which can then be consumed by the .NET 8.0 application. This hybrid approach allows for a gradual migration. 

    4.Resolve Dependency Issues: For compatibility issues with dependencies like System.ServiceModel, explore alternatives such as CoreWCF for .NET 6/7/8 or consider transitioning to HTTP-based services (REST/gRPC) for better long-term compatibility.   

    If you have found the answer provided to be helpful, please click on the "Accept answer/Upvote" button so that it is useful for other members in the Microsoft Q&A community.


  2. Bruce (SqlWork.com) 75,051 Reputation points
    2025-04-26T18:50:45.45+00:00

    For .net core you need to use the EF 6 2.1 standard version, which is not supported by net 4.*. This means you will need your common libraries to be built multiple platform, and may require some conditional compile. This is pretty easy to do. See:

    https://learn.microsoft.com/en-us/nuget/create-packages/multiple-target-frameworks-project-file

    in your case I’d probably target .netstandard 2.0 and 2.1 (or later). You will use framework conditions to control library and nuget packages for each target in the project file. Because of the 2.0 target, you will be limited to c# 7.3 syntax.

    https://learn.microsoft.com/en-us/visualstudio/msbuild/msbuild-conditions?view=vs-2022


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.