Getting started with .NET 10.0 on RHEL 8
Installing and running .NET 10.0 on RHEL 8
Abstract
Providing feedback on Red Hat documentation
We appreciate your feedback on our documentation. Let us know how we can improve it.
Submitting feedback through Jira (account required)
Procedure
- Log in to the This content is not included.Jira website.
- Click Create in the top navigation bar
- Enter a descriptive title in the Summary field.
- Enter your suggestion for improvement in the Description field. Include links to the relevant parts of the documentation.
- Click Create at the bottom of the dialogue.
Chapter 1. Introduction to .NET 10.0
.NET is a general-purpose development platform that features automatic memory management and modern programming languages. You can use .NET to build high-quality applications efficiently. Generally, .NET is available on Red Hat Enterprise Linux (RHEL) and OpenShift Container Platform through certified containers.
With .NET, you can:
- Follow a microservices-based approach, building some components with .NET and others with languages like Java. All components can run on a common, supported platform on Red Hat Enterprise Linux and OpenShift Container Platform.
- Develop new .NET workloads on Microsoft Windows and then deploy and run those applications on either Red Hat Enterprise Linux or Windows Server.
- Run .NET applications in a heterogeneous data center, removing the requirement to rely specifically on Windows Server for your underlying infrastructure.
Chapter 2. Installing .NET 10.0
.NET 10.0 is included in the AppStream repositories for RHEL 8. These repositories are enabled by default on RHEL 8 systems.
The dotnet-sdk-10.0 package installs both the .NET Software Development Kit (SDK) and the corresponding .NET runtime. When a newer SDK version for .NET 10.0 becomes available, you can update your installation using dnf.
Prerequisites
Installed and registered Red Hat Enterprise Linux (RHEL) 8 with all required subscriptions attached
For more information, see Interactively installing RHEL from installation media.
Procedure
Install the
dotnet-sdk-10.0package and its dependencies:$ sudo dnf install dotnet-sdk-10.0 -y
Verification
Verify that .NET is installed correctly:
$ dotnet --infoThe output displays information about the installed .NET SDK and runtime environment.
Chapter 3. Creating an application using .NET 10.0
To ensure your development tools are properly configured, you can create a basic "Hello World" application. This process tests the core functionality of the .NET SDK, ensuring that you can successfully generate, build, and run projects from the command line.
Learn how to create a C# "Hello World" application.
Prerequisites
- Installed .NET 10.0 SDK
Procedure
Create a new console application in a directory named
<my-app>:$ dotnet new console --output <my-app>Run the application from its project directory:
$ dotnet run --project <my-app>
Verification
Verify that the application runs and displays the expected output:
Hello World!
Chapter 4. Publishing .NET 10.0 applications
When you publish a .NET 10.0 application, you can choose one of the following deployment methods:
- Self-contained deployment (SCD): The application includes the .NET runtime. This method uses a runtime built by Microsoft.
- Framework-dependent deployment (FDD): The application uses a shared, system-wide version of the .NET runtime.
Red Hat recommends using FDD when publishing an application for Red Hat Enterprise Linux. FDD ensures the application uses an up-to-date .NET runtime that is built by Red Hat and includes tested native dependencies.
Learn how to publish a framework-dependent application.
Prerequisites
- A .NET application to publish
Procedure
Publish the framework-dependent application:
$ dotnet publish <my-app> -f net10.0Optional: If the application is for RHEL only, trim out the dependencies needed for other platforms:
$ dotnet publish <my-app> -f net10.0 -r rhel.8-<architecture> --self-contained falseReplace
<architecture>with one of the following values based on your platform:-
x64for 64-bit Intel/AMD -
arm64for 64-bit Arm -
s390xfor 64-bit IBM Z and LinuxONE -
ppc64lefor 64-bit PPC (Little Endian)
-
Verification
Verify that the application was published by listing the contents of the
publishdirectory:$ ls <my-app>/bin/Debug/net10.0/publish/
Chapter 5. Running .NET 10.0 applications in containers
To run .NET applications in an isolated environment, build container images directly from the .NET SDK and execute them using Podman.
You can use the ubi9/dotnet-100-aspnet image to run an ASP.NET Core application inside a Linux container.
For non-ASP.NET Core .NET applications, use the smaller ubi9/dotnet-100-runtime image.
Prerequisites
- You have installed .NET 10.0 SDK.
- You have installed Podman.
-
You have network access to the container registry specified in the
ContainerBaseImageattribute (registry.access.redhat.com).
Procedure
Create a new ASP.NET Core MVC project in a directory named
mvc_runtime_example:$ dotnet new mvc --output mvc_runtime_examplePublish the project:
$ dotnet publish mvc_runtime_example -f net10.0 /p:PublishProfile=DefaultContainer /p:ContainerBaseImage=registry.access.redhat.com/ubi9/dotnet-100-aspnet:latestRun your image:
$ podman run --rm -p 8080:8080 mvc_runtime_example
Verification
View the application running in the container:
$ xdg-open http://127.0.0.1:8080
Chapter 6. Migration from previous versions of .NET
Upgrade your existing applications to .NET 10.0 to benefit from the latest performance improvements and long-term support. You can migrate from earlier .NET versions or port code from the .NET Framework to modernize your workloads.
6.1. Migration guidance for .NET
Microsoft provides detailed guidance for migrating between different versions of .NET and ASP.NET Core. If you are upgrading from an older .NET version, refer to the official Microsoft documentation for your specific upgrade path.
- Content from learn.microsoft.com is not included.Migrate from ASP.NET Core 9.0 to 10.0
- Content from learn.microsoft.com is not included.Migrate from ASP.NET Core 8.0 to 9.0
- Content from learn.microsoft.com is not included.Migrate from ASP.NET Core 7.0 to 8.0
- Content from learn.microsoft.com is not included.Migrate from ASP.NET Core 6.0 to 7.0
- Content from learn.microsoft.com is not included.Migrate from ASP.NET Core 5.0 to 6.0
- Content from learn.microsoft.com is not included.Migrate from ASP.NET Core 3.1 to 5.0
- Content from learn.microsoft.com is not included.Migrate from ASP.NET Core 3.0 to 3.1
- Content from learn.microsoft.com is not included.Migrate from ASP.NET Core 2.2 to 3.0
- Content from learn.microsoft.com is not included.Migrate from ASP.NET Core 2.1 to 2.2
- Content from learn.microsoft.com is not included.Migrate from .NET Core 2.0 to 2.1
- Content from learn.microsoft.com is not included.Migrate from ASP.NET to ASP.NET Core
- Content from learn.microsoft.com is not included.Migrating .NET Core projects from project.json
- Content from learn.microsoft.com is not included.Migrate from project.json to .csproj format
If you are migrating from .NET Core 1.x to 2.0, the initial sections of the Content from learn.microsoft.com is not included.Migrate from ASP.NET Core 1.x to 2.0 article provide the relevant guidance.
6.2. Porting from .NET Framework
When migrating an application from .NET Framework, refer to the official Microsoft documentation:
- General guidelines: Content from docs.microsoft.com is not included.Porting to .NET Core from .NET Framework
- Porting libraries: Content from docs.microsoft.com is not included.Porting to .NET Core - Libraries
- Migrating to ASP.NET Core: Content from docs.microsoft.com is not included.Migrating to ASP.NET Core
Some technologies and APIs from .NET Framework are not available in .NET Core or .NET. If your application or library depends on these APIs, you must either find an alternative or remain on .NET Framework.
.NET Core and .NET do not support the following technologies:
- Desktop applications, such as Windows Forms and Windows Presentation Foundation (WPF)
- Windows Communication Foundation (WCF) servers (WCF clients are supported)
- .NET remoting
Additionally, some .NET APIs are specific to Microsoft Windows environments and are not cross-platform. Examples of these Windows-specific APIs include:
-
Microsoft.Win32.Registry -
System.AppDomains -
System.Security.Principal.Windows
Some APIs that are not supported by default in .NET are available in the Content from blogs.msdn.microsoft.com is not included.Microsoft.Windows.Compatibility NuGet package.
Use this package with caution. Many of the APIs it provides, such as Microsoft.Win32.Registry, only work on Windows. Using these APIs makes your application incompatible with Red Hat Enterprise Linux.