Skip to main content

Development

.NET Core Cross Platform – Windows vs Linux

We’ve heard a lot about .NET Core over the past half year. I’m sure that enormous numbers of developers need cross-platform integration and support for services and tools. To some extent, the generation of .NET Core can be used to fulfill this need.

.NET Core is a general purpose development platform maintained by Microsoft and the .NET community on GitHub. It is cross-platform, supporting Windows, macOS, and Linux, and can be used in device, cloud, and embedded/IoT scenarios. Also, it can be ported to other operating systems. It’s very convenient.

So this post will focus on the cross-platform of .NET Core in Window and Linux. Everybody can follow my steps to learn its benefits.

Start in windows

Step 1: Download vs2017 or update vs2015

Step 2: Make sure you have installed the .NET Core workload

.NET Core Cross Platform - Windows vs Linux

Step 3: Create a console application to print out the OS type such as Windows or Linux.

.NET Core Cross Platform - Windows vs Linux

Step 4: Run it.

.NET Core Cross Platform - Windows vs Linux

Start in Linux

Step 1: Install Ubuntu 14.04. (Ubuntu is an open source Linux operating system.)

Step 2: Run the below scripts in Terminal to install .NET Core.

2.1. Register the Microsoft Product key as trusted.

.NET Core Cross Platform - Windows vs Linux

2.2 Register the Microsoft Product feed for your distro version. For me, my system is 14.04.

.NET Core Cross Platform - Windows vs Linux

2.3 Update your package catalog.

.NET Core Cross Platform - Windows vs Linux

2.4 Install .NET Core SDK.

.NET Core Cross Platform - Windows vs Linux

Note: The version of .NET Core should be consistent with what is on the Windows platform.

Step 3: Port the console app from Windows to Ubuntu. Enter the file directory. Run the app.

.NET Core Cross Platform - Windows vs Linux

.NET Core Cross Platform - Windows vs Linux

Conclusion

Using the same code, it can run on different platforms. That’s the magic of .NET Core. Lots of people will compare it with the traditional .NET Framework, .NET Core is just like a cross-platform version of the .NET Framework. With the continuous improvement of .NET Core, additional APIs and innovations will be integrated into the .NET Framework. Because they share the same standard library. .NET Core and .NET Framework seem like brothers working together to get rich. For now, if developers only develop a product in Windows, I suggest they use the .Net Framework because the technology of .NET framework is more mature and more stable. But if developers need to cross platform, it is a challenge to use .Net core. I will hope you enjoy it.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Categories
Follow Us