.Net Core is a free and open-source development platform maintained by Microsoft. It is a well-known and developed framework considered as a new version of the .NET Framework that contains various major updates. Thus, making it stable and technologically advanced.
.Net Core runs on Windows, macOS, and Linux operating systems which makes it a cross-platform framework. You can leverage .Net Core to build various applications for mobile, desktop, Cloud, IoT, Machine learning, web, microservices, etc. It consists of certain core features that assist in running a basic .Net Core app successfully. Let’s check out some of the features of Net Core as mentioned below:
- It can implement modern development paradigms like asynchronous programming.
- Performs highly with tiered compilations and intrinsics.
- It is highly consistent across every supported platform.
- Command-line tools can be included.
- Can be easily integrated in your app.
Now, let’s move to the most exciting part, where we will take you through the procedure of migrating .Net Framework to .Net Core.
How to Migrate?
Once you’ve decided to migrate to .Net Core, here’s a quick guide to carry out the procedure without much difficulty:
- Use portability analyzer tool once the .Net solution is ready for migration. It will give you an idea regarding the labor-intensive porting from one platform to another.
- If your existing solution has used NuGet packages, just be sure regarding its compatibility with .Net Core. Use the NuGetPackageExplorer tool to check for compatibility.
- Changes of .csproj file format simplification into ASP.NET Core includes: Inclusion of files explicitly isn’t necessary for the project; it reduces the risk of XML merging conflicts when you work on large teams. File readability is improved due to the absence of GUID-based references. You can edit the file without uploading it in the visual studio.
- Update the namespace by deleting all the uses of the System.Web and then replace it with Microsoft.AspNetCore.
- Now, instead of using the global.asax, configure your Startup.cs file. ASP.NET Core will load the app. As the app’s entry point is Startup, so there isn’t any dependency on Global.asax file. Middlewares will get registered in the app by startup and then the startup should incorporate the configure method. Add the required middleware to the pipeline in configure.
- You might come across some issues in Startip.cs that I feel you should pay heed to before executing the next step. Please go through the issues as given below:
- Issues while configuring the middleware for your MVC and WebAPI requests
- You will come across multiple collisions during the porting procedure, so set up the exception handling in your development environment. With UseDeveloperExceptionPage, just add the middleware to catch exceptions.
- In the MVC routing, the registration for new routes has been amended. So, instead of your RouteCollection the IRouteBuilder is used to register restrictions in IActionConstraint.
- Update the filters MVC/WebAPI following the ASP.NET Coe’s new implementation.
- Formatters of MVC/WebAPI and binding models.
- Don’t forget to include Area in an ASP.NET Core app. Then add a regular route to your Startup.cs file.
7. Now, migrate the HTTP handlers along with your HTTpModules to Middleware using the built-in DI. Next, you should use the WebAPI project Compatability shells.
8. You will see a porting application configuration, just port the static content to wwwroot and EntityFramework to EF Core.
9. Now you should remove all the HttpContext references. Just replace the obsolete classes and change the namespace too.
10. You will see an authentication and authorization update. The JS/CSS will be updated.
11. Finally, you will see the porting being carried out. And, with this, the migration of .Net framework to .Net Core is carried out successfully.
With this, the process of migrating the .Net framework to .Net Core is carried out successfully. As you are already aware of the fact that .Net Core is here to stay and is a future for multi-platform applications. It also offers new native features that are usually not supported by the traditional framework. So, as a final word, you should constantly review your app’s functionality and then choose the migration approach. Choose the platform that would suit the context appropriately for your existing applications.
I relish, cause I discovered just what I was looking for.
You’ve ended my four day long hunt! God Bless you man. Have a nice day.
Bye
Some genuinely good blog posts on this site, appreciate it for contribution.