When running a dotnet app, I get:
It was not possible to find any compatible framework version
The framework 'Microsoft.NETCore.App', version '3.1.0' was not found.
- The following frameworks were found:
5.0.10 at [/opt/rh/rh-dotnet50/root/usr/lib64/dotnet/shared/Microsoft.NETCore.App]
You can resolve the problem by installing the specified framework and/or SDK.
The specified framework can be found at:
- https://aka.ms/dotnet-core-applaunch?framework=Microsoft.NETCore.App&framework_version=3.1.0&arch=x64&rid=rhel.7-x64
But it is installed! dotnet -v returns the 5.0.0 version since that is the latest one. How do I get it to find the 3.1 runtime?
/opt/rh/rh-dotnet31/root/etc/dotnet
/opt/rh/rh-dotnet31/root/usr/bin/dotnet
/opt/rh/rh-dotnet31/root/usr/lib64/dotnet
/opt/rh/rh-dotnet31/root/usr/lib64/dotnet/dotnet
/opt/rh/rh-dotnet50/root/etc/dotnet
/opt/rh/rh-dotnet50/root/usr/bin/dotnet
/opt/rh/rh-dotnet50/root/usr/lib64/dotnet
/opt/rh/rh-dotnet50/root/usr/lib64/dotnet/dotnet
Unfortunately, .NET packages provided by Red Hat on RHEL 7 aren't truly side-by-side. That's only the case in RHEL 8 and later.
To do what you want to do, you probably want to make .NET Core 3.1 part of the current environment by running this in a new shell (or terminal):
scl enable rh-dotnet31 -- bash
This command isn't persistent. It starts a new bash session in which .NET Core 3.1 is the default .NET version.
In general, for RHEL 7, you can pick which .NET version to enable at a time by using:
scl enable rh-dotnetXY bash
To start a new shell session where .NET version XY is available.
If you want true side by side installation, .NET packages in RHEL 8 all install to /usr/lib64/dotnet
and will work side by side.
For more details, see https://access.redhat.com/documentation/en-us/net/3.1/html/getting_started_with_.net_on_rhel_7/using-dotnet-on-rhel_getting-started-with-dotnet-on-rhel-7#installing-dotnet_using-dotnet-on-rhel