e-Zest members share technology ideas to foster digital transformation.

How to apply .NET applications on all platforms?

Written by Sachin Katkar | Feb 12, 2019 9:51:00 AM

What is your recommendation on developing an application using Microsoft platform, which is open source, supports cross-platform and is cost-effective?

This is a common question from business owners during sales calls.

The answer to this question is .NET Core.

In this article, we will be talking about understanding .NET Core and the key features of this framework.

About .NET Core

.NET Core is a free and open source managed framework for Windows, Mac and Linux Operating Systems.

.NET Core is named as “Core” because it includes Core features of .NET framework. The main objective of a .NET Core is to make .NET framework compatible for the resource-constrained environment. The following figure illustrates the components of .NET Core.

Below are some of the key important characteristics of .NET Core

One of the key challenges of using Microsoft platform is the inability to host ASP.NET applications on other platforms besides Windows. This ultimately leads towards having a direct dependency on Microsoft’s various tools that provide a capability to develop, build and deploy ASP.NET applications.

The biggest thing about ASP.NET Core is its compatibility with Windows, Linux and even Mac platforms. The structure of ASP.NET is re-architected in such a way that you can develop your own .NET applications on all platforms.

  • Visual Studio can be used on Windows with a new limited version on the MacOS
  • Visual Studio code can be used on Windows, Linux and MacOS
  • The command line can be used on all supported platforms

Open Source

The .NET Core platform is open source. You can get instant solutions to your problems because of its open source nature. .NET Core is available on GitHub and it is constantly being managed by people who are Microsoft contributors and open source community members. This increases the transparency between developer and core framework.

Cost-effective

From the customer's point of view, you can make your application economical with respect to development and hosting. With .NET Core, you do not have to worry about paying Microsoft resource to manage your application. You can develop the applications yourself using tools that are available on all platforms.

When to choose .NET Core

Along with the key characteristics mentioned above, if you want to develop the application which supports the following features, it is best to use .NET Core as your development framework.

  • Microservices architecture
  • Using docker container
  • High-performance and scalable systems
  • A need for side by side .NET versions per application level

Development environment

To develop ASP.NET Core application, the following must be installed in your system:

  • .NET Core SDK
  • Integrated Development Environment (IDE)

ASP.NET Core is a part of .NET Core SDK, so you do not need to install it separately.

Languages

C#, Visual Basic, and F# languages can be used to write applications and libraries for .NET Core. These languages can be integrated into your favourite text editors and IDEs, including Visual Studio, Visual Studio Code, Sublime Text and Vim.

Port code from .NET Framework to .NET Core

If you have a code that runs on Microsoft .NET framework, and if you want to port it to .NET Core, below is the overview on the porting process:

  • Identify and account for your third-party dependencies
  • Retarget all projects you wish to port to target the .NET Framework 4.7.2 or higher
  • Use the .NET Portability Analyser to analyze your assemblies and develop a plan to port based on its results
  • Port your tests code
  • Execute your plan for porting

Tools to help

The following list shows tools you might find helpful to use during the porting process:

  • .NET Portability Analyzer - command line tool or Visual Studio Extension is a toolchain that can generate a report of how portable your code is between .NET Framework and .NET Core, with an assembly-by-assembly breakdown of issues. For more information, see .NET Portability Analyzer.
  • .NET API analyzer - A Roslyn analyzer that discovers potential compatibility risks for C# APIs on different platforms and detects calls to deprecated APIs. For more information, see .NET API analyzer.
  • Reverse Package Search - A useful web service that allows you to search for a type and find packages containing that type.

References:

https://docs.microsoft.com/en-us/dotnet/Core/porting/index

http://www.tutorialsteacher.com/core/aspnet-core-introduction

https://stackify.com/net-core-vs-net-framework/

https://docs.microsoft.com/en-us/dotnet/

https://github.com/dotnet/docs/blob/master/docs/core/porting/index.md