How to host multiple .NET Core versions
Environment
- Red Hat Enterprise Linux 7
- .NET Core
- 2.0
- 2.1
- 2.2
- 3.0
Issue
- I am looking for guidance on running multiple versions of .NET Core on Red Hat Enterprise Linux.
- Installing a second version of .NET Core results in file conflicts reported by yum.
Resolution
A simple solution is to remove .NET Core 2.0 using yum and install the newer version (2.1, 2.2 or 3.0).
If that's not possible, you can work around the file conflict manually.
Because of the file conflict warning reported by yum between .NET Core 2.0 and other .NET Core packages, the new .NET Core package needs to be downloaded then installed using the rpm command. The instructions below assume you already have a version of .NET Core 2.0 installed on the system, like rh-dotnet20.
-
Download the rh-dotnet30-dotnet-host rpm package. Note that this will install the latest version of rh-dotnet30, and the package version may differ if you are updating to a different minor version.
$ sudo yumdownloader rh-dotnet30-dotnet-host-3.0.0-3.el7.x86_64 -
Install the downloaded rpm using the
--nodepsand--replacefilesoptions.$ sudo rpm -i --nodeps --replacefiles rh-dotnet30-dotnet-host rh-dotnet30-dotnet-host-3.0.0-3.el7.x86_64.rpm -
Proceed with installing or upgrading the rh-dotnet30 package. A warning that says, "Warning: RPMDM altered outside of yum." can be safely ignored.
$ sudo yum install --skip-broken rh-dotnet30
Root Cause
The various .NET Core package versions use the same /usr/share/bash-completion/completions/dotnet file to provide bash completion for the dotnet commands. The files have the same same contents in .NET Core 2.1, 2.2 and 3.0, but different in 2.0. Attempting to install multiple versions of .NET Core with different contents of this file on the same machine causes yum to see a file conflict..
This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.
Comments