Is it worth it? Yes. It's more standard, faster, easier to maintain, and it's where Microsoft is putting its effort .NET Framework X.X is still supported, but it only gets security and reliability fixes, no new features. So if you're still in doubt, it's a good move.
These are general tips and lessons learned. Follow them in whatever order makes sense for your application, and only apply the ones you actually need. You don't have to do everything at once.
Main Topics
- Modernize Configuration, Dependency Injection and Startup.cs into Program.cs
- Modernize your legacy Entity Framework into EF Core
- Create unit, integration and/or smoke tests
- Try to migrate from Newtonsoft to System.Text.Json and validate your dependencies
- Validate deployment and rollback
1- Modernize Configuration, Dependency Injection and Startup.cs into Program.cs
For modern ASP.NET Core apps, Program.cs is the standard entry point. If you're migrating from a .NET Framework app, this may involve moving away from Global.asax, Web.config, or OWIN startup configuration. If you're already using ASP.NET Core with Startup.cs, you don't have to change it just for the sake of changing it, but the newer templates use Program.cs for the hosting setup.
I'd start by reviewing the API, endpoints, or Azure Functions. An old API usually has different annotations and base classes than a modern one (for example, an in-process Azure Function uses [FunctionName] while the isolated worker uses [Function], and Web API controllers become ASP.NET Core controllers with attributes like [ApiController] and [Route]), so expect to update those first. Then make sure the new startup configuration covers what your application needs, such as dependency injection, logging, configuration, and middleware.
Legacy .NET Framework applications often rely on Web.config and calls like ConfigurationManager.AppSettings["Key"]. In modern .NET, you can use appsettings.json, environment variables, and the built-in dependency injection system. The Options pattern (IOptions<T>) is also useful when you want to bind configuration sections to strongly typed classes and inject them into your services. You don't necessarily have to move every setting into JSON; choose the configuration approach that fits your application and deployment environment.
When registering services, choose the right lifetime:
- Transient: A new instance is created each time the service is requested from the container.
- Scoped: One instance is created per scope—typically per HTTP request in a web app. EF Core's
DbContextis scoped by default. - Singleton: One instance is shared for the lifetime of the application, so it must be thread-safe when used concurrently.
The classic trap is injecting a Scoped service into a Singleton, because it stays alive much longer than it should and causes bugs that are hard to find in production.
For Azure Functions, migrating from the in-process model to the isolated worker model is important if you want to use .NET 10. Microsoft support for the in-process model ends on November 10, 2026, so check the current migration guidance if your app still uses it.
2 - Modernize your legacy Entity Framework into EF Core
This is highly recommended too, since EF Core is faster, actively developed, and works well with async/await queries. (EF6 had async support too, but EF Core is where all the new work happens.)
If you're using an AI assistant for the migration, you can add something like this to your prompt: "if there are any queries that can use async/await, do it". Just remember that async spreads through your call chain, so avoid mixing it with .Result or .Wait(), that's how you get deadlocks.
There are now 2 main dependencies, Microsoft.EntityFrameworkCore and Microsoft.EntityFrameworkCore.YourDBProvider (for example ...SqlServer), please notice that. If you use migrations you'll also need Microsoft.EntityFrameworkCore.Design / Tools.
Some things to keep in mind:
- It's not a drop-in replacement. EDMX / the designer is gone, lazy loading needs to be enabled explicitly, and some queries behave differently, so test them.
- Your old EF6 migration history doesn't carry over, so plan how you'll handle your database schema.
- Match your EF Core version with your .NET version (EF Core 10 for .NET 10).
- If it's too much at once, EF 6.3+ runs on modern .NET, so you can move to .NET first and do EF Core later.
3 - Create unit, integration and/or smoke tests
A lot of legacy applications don't have enough automated tests. If your application already has good coverage, great—you can focus on reviewing and updating those tests. If it doesn't, I'd highly recommend adding some before or during the migration.
A few distinctions:
- Unit tests: Test a small piece of code in isolation. You can use representative mock data, including JSON fixtures, where that makes sense.
- Integration tests: Check that multiple parts work together, such as your application and database.
- Smoke tests: Cover the essential flows that tell you whether the application is basically working, for example a critical transaction or communication with an external device. These run against the application already deployed and running in a real environment (dev or QA), not just a local
dotnet run, and they can be added as a step in your CI/CD pipeline right after the deployment.
For a migration, I'd first capture the behavior that already works. Then run the same tests against the modernized application and investigate any differences. Mock data is useful, but it doesn't replace integration tests against the real dependencies when those dependencies are part of what you're trying to validate.
Once you've identified the critical smoke tests, I'd share them with a coworker, QA, or another developer and ask: _Are we missing any important scenarios?_ A second pair of eyes can catch gaps that are easy to overlook when you've been working on the migration for a while.
4. Consider moving from Newtonsoft.Json to System.Text.Json
This one is a tricky one, as a matter of fact it's been the most critical one for me, because I have a sad story. I did the migration, it compiled and everything, but in prod it couldn't read a Newtonsoft property. I had ended up mixing both libraries, and System.Text.Json doesn't understand Newtonsoft attributes.
If you only use a few basic parsing or serialization methods, the migration may be straightforward. If you rely on custom converters or library-specific features, it may take more work. There's no need to migrate just for the sake of it: keeping Newtonsoft.Json can be reasonable if your application depends on its behavior.
The important lesson is that a successful build doesn't guarantee that your JSON behavior is still compatible. Review the attributes and properties you're using, and validate that the JSON is being read and written as expected.
This is also where smoke tests become important: run them against your deployed application in a development or QA environment to catch issues that might not appear when running the application locally.
5 - Validate your deployment and have a rollback plan
Running your application locally is one thing, but deploying it to a real environment is another.
Make sure your CI/CD pipeline builds and tests the migrated application, and verify that your target server or hosting environment supports the required .NET runtime and dependencies. Also, check environment-specific settings and run your critical smoke tests after deployment.
One more thing: have a rollback plan before releasing to production. If something goes wrong, you should know how to restore the previous working version without making the situation worse.
Bonus
Use CPM (Central Package Management) to control the dependencies between your many projects. This is highly recommended, since we want to unify everything (this applies if you have multiple projects in one solution). You put the versions in one Directory.Packages.props file, and your projects only reference the package name.
One last reminder: don't forget to review your dependencies, configuration, and secrets, as well as your authentication (which may also need to be upgraded) and security settings. These are easy to overlook during a migration, but they can cause unexpected issues in production. Make sure everything is still working as expected before releasing it.
These tips can guide you on how to migrate your legacy .NET Framework app, take whatever you need.
If I had to pick the most important part, I'd choose unit and smoke tests—especially tests for the critical flows. Run them locally and in your CI/CD pipeline, review the results, and ask a coworker or QA to look for missing scenarios. If you discover a gap, add the test and repeat the process.
The goal isn't just to make the project compile on a newer version of .NET. The goal is to make sure the application still does what it is supposed to do after the migration.
References
https://learn.microsoft.com/en-us/dotnet/core/porting/
← Back to all posts
