Home United States USA — software . NET Core vs. NET Framework: How to Pick a. NET Runtime...

. NET Core vs. NET Framework: How to Pick a. NET Runtime for an Application

359
0
SHARE

We take a look at. NET Core and. NET Framework, comparing the benefits of both web development frameworks, so you can decide which is best for your project.
Is. NET Core the next big thing? We’ ve been toying with it for a while now, and we tend to think that it is. In fact, we predict that there will be a huge demand for developers skilled in this technology in 2018. But how does it differ from the. NET Framework, and what do you need to know to use them effectively? In this post, we’ ll explain the main differences and offer some guidance on how to make the best use of each.
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.. NET Core provides a standard base library that can now be used across Windows, Linux, macOS, and mobile devices (via Xamarin) .
There are four major components of. NET architecture:
Microsoft maintains both runtimes for building applications with. NET and they share many of the same APIs. This shared API is what is called the. NETStandard.
Developers use the. NET framework to create Windows desktop applications and server based applications. This includes ASP. NET web applications.. 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.
C# is an object-oriented language similar to other C-styled languages. The learning curve should not be a problem for developers already working with C and similar languages.
F# is a cross-platform language that also uses object oriented programming.
Visual Basic is available in the. NET Framework with limited. NET Core support with. NET Core 2.0.
A cross-platform and open-source framework, it can be used to develop applications on any platform. Often it is used for cloud applications or refactoring large enterprise applications into microservices.
So when should you use it? When…
One issue is that it does not have some. NET features or support all libraries and extensions. There are a few situations in which it may not (currently) be the best option, although, with continued development, it will likely be workable for most use cases eventually. Consider the following scenarios:
. NET Framework is what is distributed with Windows. Generally, it is used to build desktop Windows apps and large-scale enterprise applications using. NET workflow and data connection tools.
It provides services that include:
It can be used with Docker and Windows Containers, and using it is most feasible when…
There are also a few situations in which you shouldn’ t run the. NET Framework, including when:
This involves more than just knowing what the third party dependencies are. There needs to be an understanding of how the app depends on those third party dependencies if they run on. NET Core, and what needs to be if they do not run.
NuGet packages are easy to check because it usually says on NuGet’s website plus the package has a set of folders for each platform. You can also look under Dependencies on the page for the package and look for a folder or entry with any of the following names:
If the dependencies are not NuGet packages, the ApiPort tool can check the portability of the dependency.
New with. NET Core 2.0, a compatibility shim can make it possible to reference. NET Framework packages that have not been switched to use. NET Standard. Be sure to thoroughly test these packages as they may still have issues if they use unsupported APIs.
The. NET Standard library is intended to be available on all. NET runtimes, so targeting the. NET Standard library is the best way to build a cross-platform class library.
There are multiple versions to consider that are available to varying degrees across eight platforms. If a project targets a lower version, it cannot reference a project that targets a higher version. Pick the lowest possible. NET Standard version to use across all projects. Below is a chart with each. NET Standard version that shows the specific areas they run on:
All the projects to be ported need to be targeted to. NET Framework 4.6.2. This will ensure API alternatives for. NET Framework specific targets can be used for non-supported APIs.
This is done easily in Visual Studio with a “Target Framework” command and recompiling the projects.
Porting code to. NET Core is a significant change; testing is strongly encouraged. Use a suitable testing framework such as:
With tools like xUnit, it’s possible to use templates and edit them to write. NET Core tests. Here’s an example of an edited.csproj file:
The best way to port the code depends on how the framework is structured. But breaking the code base into steps and layers should work well.
Xamarin may sound like a new prescription medication, but Xamarin is a platform for developing apps that run on iOS, Android, or Windows Phone devices.
Xamarin is written in C# and included in all editions of Visual Studio.
Microsoft promises that Xamarin is the best way to create a user interface (UI) and optimize performance in apps in multiple platforms. This is important during an era when apps need to run on at least iOS and Android devices.
Xamarin shares code across platforms and uses a single technology stack to decrease time to market and engineering costs. But user interface intensive apps may need more platform-specific coding. The amount of code sharing and savings then decreases.
In addition to. NET Framework, . NET Core and Xamarin, . NET Standards also supports the following platforms:
All these platforms will implement. NET Standards — a common set of APIs that replaces portable class libraries (PCLs) . This ensures code sharing across desktop applications, mobile apps and games, and cloud services.
For more information, including helpful tutorials, visit the following resources:

Continue reading...