.NET Core vs .NET Framework?

 A while back, we predicted that .NET Core would be the next big thing, offering developers many options in application development. Indeed, there is huge demand for developers skilled in this technology. But how does it differ from the .NET Framework, and what do you need to know to use them both effectively?

Today, we’ll contrast .NET Core vs .NET Framework to help you choose which one to use for your next project. In this post, we’ll explain their key differences and how to make the best use of each.  Look at history of .NET Framework below for more understanding.

Historically, the .NET Framework has only worked on Windows devices. The Xamarin and Mono projects worked to bring .NET to mobile devices, macOS and Linux. Now, .NET Core provides a standard base library that’s usable across Windows, Linux, macOS and mobile devices (via Xamarin).


There are four major components in .NET architecture

Common language specification (CLS) defines how objects are implemented so they work everywhere .NET works. 

CLS is a subset of Common Type System (CTS) – which sets a common way to describe all types

Framework class library (FCL) is a standard library that collects reusable classes, interfaces and value types

Common language runtime (CLR) is the virtual machine that runs the framework and manages the execution of .NET programs

Visual Studio is used to create standalone applications, interactive websites, web applications and web services

NET Core vs .NET Framework

Microsoft maintains both runtimes for building applications with .NET while sharing many of the same APIs. This shared API is called the .NET Standard.



Developers use the .NET Framework to create Windows desktop and server-based applications. This includes ASP.NET web applications. On the other hand, .NET Core is used to create server applications that run on Windows, Linux and Mac. It does not currently support creating desktop applications with a user interface. Developers can write applications and libraries in VB.NET, C# and F# in both runtimes.

When to Use .NET Core

A cross-platform and open-source framework, .NET Core is best when developing applications on any platform. .NET Core is used for cloud applications or refactoring large enterprise applications into microservices.

There are cross platforms needs: Platforms such as Windows, Linux and macOS. Those operating systems are supported as development workstations (and the list of supported operating systems is growing)

  • Visual Studio is compatible on Windows with a new limited version on macOS
  • Visual Studio Code can be used on Windows, Linux and macOS
  • All supported platforms allow the use of the command line

Using Microservices. Microservices, a form of service-oriented architecture, are software applications consisting of small, modular business services. Each service can run a unique process, be deployed independently and be created in different programming applications. .NET Core allows a mix of technologies, is lightweight and scalable for each microservice

Working with Docker containers. Containers and microservices architecture are often used together. Because it is lightweight and modular, .NET Core works very well with containers. You can deploy cross-platform server apps to Docker containers. .NET Framework works with containers, but the image size is larger

You have high-performance and scalable system needs. Microsoft recommends running .NET Core with ASP.NET Core for the best performance and scale. This becomes important when using hundreds of microservices. In such a case, a lower number of servers and virtual machines is best. The efficiency and scalability gained should translate to a better user experience in addition to cost savings

You are running multiple .NET versions side-by-side. To install applications with dependencies on different versions of frameworks in .NET, developers need to use .NET Core. Multiple services are executable on the same server with different versions of .NET

You want command line interface (CLI) control. Some developers prefer working in lightweight editors and command line control. .NET Core has a CLI for all supported platforms and requires minimal installation on production machines. And, there still is the opportunity to switch to an IDE, such as Visual Studio IDE


When Not to Use .NET Core

.NET Core does not have some of the .NET features nor support for all libraries and extensions. As such, you may encounter a few situations in which .NET Core may not be the best option (though continued development will likely eliminate this drawback). Consider the following scenarios:

Windows Forms and WPF applications are not supported – You still have to use Mono to make a .NET desktop application for macOS

ASP.NET WebForms don’t exist – Though Microsoft provides strategies for migrating ASP.NET Web Forms apps

You need to create a WCF service – .NET Core does not currently support WCF. Instead, you would need to make a REST API with ASP.NET Core MVC

Missing 3rd-party library support – .NET Core provides a compatibility shim between .NET Framework and .NET Core. But, you may still have issues with compatibility if the class library uses any .NET Framework APIs that are not supported (though this will help bridge a lot of class libraries to .NET Core)

Missing .NET Framework features – Some .NET Framework functionality is still missing in .NET Core. For example, Entity Framework Core is not the exact same as Entity Framework v6

You need to access Windows-specific APIs – If your application needs to work with the Windows Registry (WMI or other Windows specific APIs), it won’t work with .NET Core. It is designed to be more sandboxed away from the OS

Developers Should Use .NET Framework When

.NET Framework is distributed with Windows. Generally, it is used to build Windows desktop and large-scale enterprise applications using .NET workflow and data connection tools.

The .NET Framework provides services that include:

  • Memory management
  • Type and memory safety
  • Security
  • Networking
  • Application deployment
  • Data structures
  • APIs

.NET Framework can be used with Docker and Windows Containers and is most feasible when:

It is already being used – Instead of migrating, extend the application. For example, developers can write a new web service in ASP.NET Core

You’re using third-party libraries or NuGet packages not available in .NET Core – Despite .NET Core’s popularity, you’ll need to use the .NET Framework when working with libraries that aren’t compatible with .NET Core. NuGet is the free and open source package manager for .NET and other Microsoft development platforms. The NuGet ecosystem includes client tools that provide the ability to produce and consume packages. It also has a central package repository for package authors and consumers. It is available as a Visual Studio extension

You’re using technologies not yet available in .NET Core – .NET Core does not support all .NET Framework technologies. These not-yet-available technologies include:

  • ASP.NET Web Forms applications (no plans to port)
  • ASP.NET Web Pages applications (plans to port)
  • ASP.NET SignalR server/client implementation (plans to port)
  • WCF services implementation (no plans to migrate, but it is being considered)
  • Workflow related services (no plans to port) including Windows Workflow Foundation (WF), Workflow Services (WCF + WF in a single service), and WCF Data Services (formerly known as “ADO.NET Data Services”)
  • Windows Presentation Foundation (WPF) and Windows Forms (no plans to port)

The platform does not support .NET Core – Again, not all Microsoft and third-party platforms support it, such as some of Azure’s services. You may encounter some issues even with supported services, which comes with the territory. With .NET Core increasingly gaining traction, it’s becoming easier to find tutorials and workarounds for issues you may encounter. For instance, we encountered a 502.5 Process Failure when trying to start an Azure App Service. So, we published a post offering guidance for others who encounter the same issue

When Not to Run .NET Framework

There are also a few situations in which you shouldn’t run the .NET Framework. These include when:

  • Multiple OS platforms are required
  • High performance and scalability are needed
  • .NET Core works
  • Open source framework is required


Comments

Popular posts from this blog

Email Sending through O365 using OAuth Protocol

IoT Technology

What is reverse proxy?