Transitioning to .NET Core on Red Hat Enterprise Linux

By Don Schenck
Published: 2016-09-29

The .NET world has changed, and decidedly for the better. Not only is .NET Core now an open source framework, but thanks to Microsoft’s recent partnership with Red Hat, you can develop and run .NET web applications on Linux.

  • Build "hello world" console and web apps, and then examine the code output
  • Create a more complex model-view-controller web app with the ASP.NET MVC framework
  • Develop a RESTful service with the same techniques and technologies used for your MVC website
  • Get acquainted with several new features in Entity Framework Core 1.0
  • Use Visual Studio Code, the free code editor that supports several languages and operating systems
  • Learn how to keep and run your code in Linux and edit it in Windows
  • Perform "offroad debugging" on .NET applications from Visual Studio

Book Excerpt

This book is targeted at — but not limited to — .NET developers with any level of experience. Starting with a basic “Hello World” console application, it moves along through ASP.NET, MVC, and Entity Framework applications, eventually arriving at a full-featured application running in a Linux container. Because the code in this book is limited to C#, your existing knowledge of .NET and C# will largely determine the speed at which you progress through this volume. More experienced developers will be interested in the few key differences when developing for Linux (and there are quite a few), whereas beginning developers can use this book to learn more advanced programming techniques.

Want to see more? Get the entire book.

Other available formats:  mobi  |  epub

.NET Core

Runtimes and APIs for building and running .Net applications on Linux and in containers.
Main Content

Microsoft’s .NET Framework has enjoyed 15 years of success and improvement on the Windows platform. With support for multiple languages as well as development models such as Model View Controller (MVC) and Object Relational Mapping (ORM), it has become the standard for Microsoft-centric application-development shops.

.NET Core is a major release with significant improvements over the 1.0 and 1.1 versions, and Red Hat makes this available on: 

  • Red Hat Enterprise Linux
  • Red Hat Enterprise Linux Atomic Host
  • Red Hat OpenShift Container Platform  
  • Red Hat OpenShift Dedicated
  • Red Hat OpenShift Online
  • Red Hat OpenStack Platform

.NET Core much more in line with traditional .NET Framework, with a massively expanded API surface support for .NET Standard 2.0, and far better support for NuGet packages.

Beyond just a Windows platform, the delivery of .NET Core brings that framework to Linux and Mac OS as well. By using this new framework, Linux developers can write C# code that will run on any platform, with performance rivaling or exceeding most other platforms.

Red Hat and Microsoft have partnered to make Red Hat available as a platform within Microsoft’s Azure cloud solution and to make the .NET environment on Red Hat Enterprise Linux (RHEL) and OpenShift Container Platform a first-class experience.

Have more questions?

Read the frequently asked questions document about Red Hat and .NET Core.

Hide Get Started
Page Description
.NET Overview
Additional Content

An entire community is forming around .NET Core, making it easier than ever to get your questions answered. Red Hat is committed to being an integral part of that community with answers, tips and innovations that can help you get code up and running.

Download your no-cost developer edition of Red Hat Enterprise Linux and get started today.

Product Feature Image and Text

A simple command will install .NET Core on your RHEL machine in seconds. No more waiting for bulky, time-consuming downloads. Get started with .NET using our time to Hello World guide.

Installing .NET Core

C#, F#, and Visual Basic developers can write applications anywhere, on any platform. Use the tools you prefer, in the environment you enjoy, and get the same results.

Write and deploy - anywhere

With web server based on libuv — the same engine as Node.js — .NET Core promises to be as fast enough for even your most taxing workloads.

Expect optimum .NET performance

Develop with .NET Core on Red Hat Enterprise Linux

To download the no-cost Red Hat Enterprise Linux developer subscription, which includes Red Hat Enterprise Linux 7 server, a collection of development tools, and much more, you must have an account and need to accept the terms and conditions of the Red Hat Developer Program. Read more about the Red Hat Developer Program Program.

Download Red Hat Enterprise Linux 7 and follow the Hello World instructions. If you'd like to try .NET Core in a Linux container, get it here.

Are you new to Red Hat Enterprise Linux?

Here’s what you need to know.

No Subscription Offering
Hello World
Hide Get Started
Hide Get Started

Introduction and Prerequisites

In this tutorial, you will set up your system to install software from the Red Hat .NET repository, which provides the latest versions of .NET Core for Red Hat Enterprise Linux. You will install .NET Core and run a simple "Hello, World" application. The tutorial should take less than 10 minutes to complete.

Before you begin, you will need a current Red Hat Enterprise Linux 7 Server or Workstation subscription that allows you to download software and get updates from Red Hat. Developers can get a no-cost Red Hat Enterprise Linux Developer Suite Subscription for development purposes by registering and downloading through

Using VirtualBox? You’ll find instructions here. Hyper-V? Your instructions are here. VMWare? Here is your link. KVM users, this way, please. Finally, yes, you can install on bare metal if you wish. Here is your page.

Be sure to register and attach a subscription to your Red Hat Enterprise Linux 7 installation to get access to .NET repositories. If this is a VM, you can register and attach by using subscription-manager:

$ su -
# subscription-manager register --auto-attach


If you need help, see Troubleshooting and FAQ.

Blue Sections

In this step, you will configure your system to obtain software, including the latest .NET Core from the .NET software repository. Instructions are provided for both the command line interface (CLI) and the graphical user interface (GUI).

Using the Red Hat Subscription Manager GUI

Start Red Hat Subscription Manager using the System Tools group of the Applications menu. Alternatively, you can start it from the command prompt by typing subscription-manager-gui.

  1. Select Repositories from the System menu of the subscription manager.

  2. In the list of repositories, check the Enabled column for rhel-7-server-dotnet-rpms. If you are using a Workstation version of Red Hat Enterprise Linux, the repository will be named rhel-7-workstation-dotnet-rpms. Note: After clicking, it might take several seconds for the checkmark to appear in the enabled column.

If you don’t see any .NET repositories in the list, your subscription might not include it. See Troubleshooting and FAQ for more information.

Using subscription-manager from the command line

You can add or remove software repositories from the command line using the subscription-manager tool as the root user. Use the --list option to view the available software repositories and verify that you have access to .NET:

$ su -
# subscription-manager repos --list | egrep dotnet

If you don’t see any .NET repositories in the list, your subscription might not include it. See Troubleshooting and FAQ for more information.

If you are using a Workstation edition of Red Hat Enterprise Linux, change -server- to -workstation- in the following command:

# subscription-manager repos --enable=rhel-7-server-dotnet-rpms


Enable .NET Core Repository
Minutes to Complete

Next step, install .NET Core 2.2:

$ su -
# yum install rh-dotnet22
Set Up Your Development Environment
Minutes to Complete

Under your normal user ID, start a Terminal window. First, use scl enable to add .NET Core 2.2 to your environment:

$ scl enable rh-dotnet22 bash

Every time you start a new shell, you’ll need to re-run the scl enable command. Consider enabling it permanently.

Now, run dotnet --version to see the version number:

$ dotnet --version

Next, create a directory and move into it. Next, run dotnet new console. This will create the C# source code for the “Hello, World” app. You can look around the source code and all the generated files to get a sense of what’s necessary to support a .NET Core application. You may notice that dotnet restore ran automatically. This fetches all the necessary dependency libraries.

Finally, run dotnet run. This will build and run the application. Note that you can run dotnet build first if you wish, but it’s not necessary for this simple console application. In the future, you’ll use dotnet build with command line options to do things such as build self-contained applications; that is, apps that can be copied and run without any need to first install .NET Core.


Working with .NET Core packages

The .NET Core software packages are designed to allow multiple versions of software to be installed concurrently. To accomplish this, the desired package is added to your runtime environment as needed with the scl enable command. When scl enable runs, it modifies environment variables and then runs the specified command. The environmental changes only affect the command that is run by scl and any processes that are run from that command. The steps in this tutorial run the command bash to start a new interactive shell to work in the updated environment. The changes aren’t permanent. Typing exit will return to the original shell with the original environment. Each time you login or start a new terminal session, you will need to run scl enable.

While it is possible to change the system profile to make .NET Core packages part of the system’s global environment, this is not recommended. Doing this can cause conflicts and unexpected problems with other applications because the system version of the package is obscured by having the other version in the path first.

Permanently enable .NET Core in your development environment

To make the .NET Core packages a permanent part of your development environment, you can add it to the login script for your specific user ID. This is the recommend approach for development as only processes run under your user ID will be affected.

Using your preferred text editor, add the following line to your ~/.bashrc:


# Add .NET Core 2.2 to my login environment
source scl_source enable rh-dotnet22

After making the change, you should log out and log in again.

When you deliver an application that uses .NET Core packages, a best practice is to have your startup script handle the scl enable step for your application. You should not ask your users to change their environment as this is likely to create conflicts with other applications.

Where to go next?

.NET Core Documentation at

Find additional .NET Core packages

$ yum list available rh-dotnet21\*

View the full list of packages

For Red Hat Enterprise Linux Server edition:

$ yum --disablerepo="*" --enablerepo="rhel-7-server-dotnet-rpms" list available

For Red Hat Enterprise Linux Workstation edition:

$ yum --disablerepo="*" --enablerepo="rhel-7-workstation-dotnet-rpms" list available


Hello World and Your First Application
Minutes to Complete
Page Description
.NET Get Started
Additional Content

Become a Red Hat developer:

Red Hat delivers the resources and ecosystem of experts to help you be more productive and build great solutions. Register for free at

Troubleshooting and FAQ
  1. As a developer, how can I get a Red Hat Enterprise Linux subscription that includes .NET Core?

    Developers can get a no-cost Red Hat Enterprise Linux Developer Suite subscription for development purposes by registering and downloading through We recommend you follow our Getting Started Guide, which covers downloading and installing Red Hat Enterprise Linux on a physical system or virtual machine (VM) using your choice of VirtualBox, VMware, Microsoft Hyper-V, or Linux KVM/Libvirt. For more information, see Frequently asked questions: no-cost Red Hat Enterprise Linux Developer Suite.

  2. I can’t find the .NET Core repository on my system.

    Some Red Hat Enterprise Linux subscriptions do not include access to .NET Core.

    The name of the repository depends on whether you have a Server or Workstation version of Red Hat Enterprise Linux installed. You can use subscription-manager to view the available software repositories and verify that you have access to .NET Core for Red Hat Enterprise Linux:

    $ su -
    # subscription-manager repos --list | egrep dotnet
  3. Can I use .NET Core in containers?

    Yes, .NET Core is available as a docker-formatted container image from the Red Hat Container Registry. Get started guides for building your first container are available on

  4. Is there an open-source community for .NET Core?

    How can I contribute or get involved with .NET Core?

    The open source community that is the upstream for .NET Core can be found at

  5. I’ve installed rh-dotnetcore11, but dotnet is not in my path.

    I can’t find the dotnet command.

    $ scl enable rh-dotnet22 bash

    For more information see the Red Hat Software Collection documentation.

  6. When I try to run dotnet, I get an error about a missing shared library.

    This is due to not having run scl enable first. When scl enable runs, in addition to setting up the command search PATH, it also sets up the search path for shared libraries, LD_LIBRARY_PATH.

  7. How do I uninstall .NET Core and any dependencies?

    Uninstalling the rh-dotnet22-runtime package will cause the dependent packages that are no longer needed to be removed.

    # yum uninstall rh-dotnet22-runtime
  8. Some .NET/C# code/examples I’ve tried don’t work with .NET Core.

    .NET Core is a new version of the .NET platform that is incompatible with the previous .NET Framework 2.x, 3.x, and 4.x series. There is a large amount of code written for .NET Framework that will not run without modification on .NET Core.

Docs and APIs
Documents Links Section

The  full .NET Core documentation for all available versions is available in the Red Hat Customer Portal. Read the latest documentation for updates and to learn more.

Hide Get Started
Page Description
.NET Docs
Hide Get Started
Show Stack Overflow
Page Description
.NET help
Main Content

.NET Foundation

Created by Microsoft, the .NET Foundation promotes community collaboration and development around the .NET open source ecosystem:

“What We Do - The .NET Foundation supports .NET open source in a number of ways. We promote the broad spectrum of software available to .NET developers through, GitHub, Codeplex and other venues. We advocate for the needs of .NET open source developers in the community. We evangelize the benefits of the .NET platform to the wider community of developers and we promote the benefits of the open source model to developers already using .NET. The .NET Foundation also provides administration and support for a number of .NET open source projects assigned to the foundation.”

Hide Get Started
Display Projects
Page Description
Main Content

.NET Core 2.2

December 2018

.NET Core 2.2 continues to broaden its support and tools for application development in an open source environment. The latest version of .NET Core includes the following improvements:

  • Open API Analyzers and Conventions to produce better Open API documentation for ASP.NET Core
  • Better link generation, more customizable and faster routing in ASP.NET Core
  • Faster MVC validation in ASP.NET Core
  • Built in support for health checks for running in container-style environment
  • Support for HTTP 2 in Kestrel
  • HTTP Client performance improvements
  • Support for SignalR clients written in Java
  • Updated templates for ASP.NET Core applications, including Bootstrap 4

.NET Core 2.1

June 2018

.NET Core 2.1 continues to broaden its support and tools for microservice development in an open source environment. The latest version of .NET Core includes the following improvements:

  • Improved build performance
  • Improved runtime performance
  • Improved networking performance
  • The new Span<T> based APIs for reducing allocations
  • Extended Cryptography APIs
  • API Support for Brotli compression
  • A new way of deploying tools as NuGet Packages

This release further reduces platform differences between Windows and Linux.


.NET Core 2.0

August 2017

  • .NET Core 2.0 simplifies packaging (over v1.0) by bundling key components, vastly increasing API support, and utilizing NuGet for package access and modularity. This results in simpler code development.
  • .NET Core 2.0 supports .NET Standard 2.0, a major upgrade towards improved compatibility, and application and library portability, across .NET Platforms (e.g. .NET Framework and .NET Core)
  • Key developer features include ASP.NET Core 2.0 (with performance improvements and key enhancements), and support for C#, F#, and Visual Basic - for building modern applications within containers. 
  • Experienced .NET developers will find .NET Core 2.0 to be a more familiar environment than previously. 


.NET Core 1.1

New application development highlights in Microsoft’s .NET Core 1.1 are:

  • Over 1,300 new APIs since .NET Core 1.0.  
  • .NET Core 1.1 docker images from Red Hat’s container registry.
  • Safe side-by-side installation with .NET Core 1.0.
  • Performance improvements

Other release details:

You can see the complete set of changes in the API between .NET Core 1.0 and .NET Core 1.1. .NET Core 1.1 is compatible with .NET Standard 1.6.0. The .NET Core 1.1 release does not contain the new CLI tooling (Preview 3). .NET Core 1.1 uses project.json (xproj) files rather than .csproj files.

.NET Core is available on Red Hat Enterprise Linux Server, Workstation, and Compute Node subscriptions.

For more information:

To learn more about .NET Core on Red Hat Enterprise Linux and Red Hat OpenShift Container Platform and how to access the components, please visit


Hide Get Started
Page Description
Hide Get Started
Main Content
Page Description
dotnet .NET Core Application Development dotnet Runtimes Off