Let’s start our discussion with defining .NET in order to become involved in the topic. .NET is a free and open-source development platform from Microsoft used to create and run different types of applications and services (desktop, web, mobile, gaming, IoT, AI and Machine learning). The platform is an integral unit of the Microsoft Windows OS.
To build apps, you can use three languages:
- Visual Basic
The platform has three high-level components, because of which, the code can run on any operating system :
- .NET Framework — for sites, services and apps on Windows
- .NET Core — for sites, server s and apps on Windows, Linux and macOS
- Xamarin — for mobile development on Android, iOS, Windows Mobile
These components share a set of API s named .NET Standard. Visual Studio and its extensions are the main tools for development experience. You can use other editors as well with the help of command line tools and plugins.
What to Choose: Xamarin or .NET Framework or .NET Core?
The choice depends on your goals. If you aim for mobile development, your only choice is Xamarin.
In case you need web-oriented solutions, you should make a choice between .NET Framework and .NET Core. They both have similarities and shareable components and can share the code as well.
Nevertheless, there is a difference between .NET Core and .NET Framework. Let’s take a closer look at them.
The .NET Framework Overview
This is a runtime environment for building Windows apps and web services. Windows Forms, WPF (Windows Presentation Foundation) and UWP (Universal Windows Platform) create Windows applications, and ASP.NET MVC is used to build web apps.
The framework includes two main components:
- The common language runtime (CLR) — the engine for running apps and providing memory management.
- The extensive class library — a set of ready-made tested reusable types of code for all development stages that any developer can use.
This technology provides the following services:
- Language interoperability. Routine programs may be written in one language and then be compiled and become accessible to other languages.
- Version compatibility. A later version of the framework can support apps developed in previous versions without modification (with rare exceptions).
- Parallel execution. Multiple apps written in different languages can coexist and run on the Framework. Thus, version conflicts are eliminated.
|Read also: IaaS vs. PaaS vs. Saas: What’s the Difference?|
The .NET Core Overview
What is .NET Core then? This is a new .NET Foundation project that can be used for developing various solutions (device, cloud, IoT). The framework is cross-platform, as it supports Windows, Linux and macOS. It uses UWP for Windows apps creation and ASP.NET Core for browser-based web apps.
Component parts are:
- A runtime — includes basic services such as assembly loading and a garbage collector
- A set of libraries — includes fundamental data
- SDK tools and compilers
- The application host — launches apps
.NET Core main characteristics:
- Open source — distributed under MIT and Apache 2 licenses
- Compatibility — uses the .NET Standard to match other platforms
- Cross-platform scripting
- Flexibility — can be deployed into your existing app
You can download .NET Core as packages on NuGet.org and as independent distributions.
Now, you see where the .NET Core vs. .NET Framework difference lies in.
|Read also: PHP vs. Node.js for Server-Side Development|
How to Make a Choice Between .NET Framework and .NET Core?
To choose the best solution, you should weigh the performance capabilities of both platforms and test them out on each individual project.
Criteria for choosing .NET Framework
The .NET Framework is a mature platform — that is why it is still popular and preferable for many app development cases. Moreover, it can’t always be replaced by new technologies.
Consider this platform in the following cases:
- Your existing app is written in .NET Framework and you only need to improve its functionality
- Your current team has deep expertise in this technology
- You need to use libraries, packages and technologies that are not available in .NET Core (e.g. ASP.NET Web Forms, ASP.NET SignalR, ASP.NET Web Pages, etc.). Some of them might be included in the next releases, others may not be available.
- You need to use a platform that requires .NET Framework only (e.g. Azure services such as Service Fabric Stateful Reliable Services)
- Your time to learn a new technology is limited
- You need a mature and stable environment for work
- You have to release quickly
- You don’t like constant upgrades and changes
Criteria for choosing .NET Core
This framework offers significant benefits for developing new applications.
Consider this platform in the following cases:
- You need to run your app on multiple platforms
- You need microservices architecture (i.e. to mix different technologies and services)
- You need to containerize your solution (the platform is modular and lightweight, so the size of containers is much smaller than with .NET Framework)
- You need systems with high performance and scalability (.NET Core runs apps using fewer servers or virtual machines)
- You need to install apps with dependencies on various .NET versions
- You are eager to learn new technologies
- You are not afraid of fixing failures (the platform is immature yet)
- You have just started learning .NET
How to Port from .NET Framework to .NET Core
Perhaps after reading this overview and the comparison of .NET Core vs. .NET Framework, you would like to port your application from one system to another. There’s always a possibility to migrate your existing code from .NET Framework to .NET Core. Here are guidelines for the porting process.
1. Identify and Analyze Third-Party Dependencies
You should understand how your solution depends on other factors, how they will run in another environment and what steps should be taken in case they don’t work. There are tools that help check the portability of dependencies, e.g. the ApiPort.
2. Retarget All Projects
The code of projects you wish to port should target .NET Framework 4.6.2. This will make all the existing APIs available even if .NET Standard doesn’t support them.
3. Analyze Assemblies
Use the API Portability Analyzer to check all the assemblies. This tool will generate a portability summary, on the basis of which you’ll be able to compile a porting plan.
4. Port Your Tests Code
Migration is a challenging process that requires big changes to the codebase, which is why testing is strongly recommended.
5. Port the Project
Break down the code into layers and port each layer separately. You can begin with the library:
- Find the base of the library that contains foundational components
- Port the test that checks the library
- Copy over the library into a new .NET Core project
- Choose the version you need
- Make necessary changes to compile the code
- Run the test program
- Make necessary adjustments
Repeat these steps for each next layer.
To Sum Up
New technologies bring new possibilities, while mature systems provide reliability and consistency. If you have doubts about which platform to choose for your project ( .NET Framework vs. .NET Core ), compare them individually focusing on all of their specific features and your particular needs.
SaM Solutions has extensive .NET expertise. We have been a Microsoft partner since 2002. As of now, SaM Solutions has a Microsoft Gold competency in app development. Our professional specialists have accumulated more than 500 worker-years of developing with .NET technologies. We look forward to becoming your partner for your next project!