Installing Multiple Versions of .NET Side-By-Side on Linux
Make sure your system has all the dependencies needed by .NET. The dependencies are listed here: https://learn.microsoft.com/en-us/dotnet/core/install/linux-scripted-manual#dependencies
Create the DOTNET_ROOT folder. Your user account needs to have write access to this folder because some of the .NET commands will need to write to this folder (for example to install a global dotnet tool).
mkdir $HOME/.dotnetDownload a version of .NET from https://dotnet.microsoft.com/en-us/download. Start with the oldest version you need, newer versions after.
Extract the file you downloaded to the DOTNET_ROOT folder.
tar -zxf <the_file_you_downloaded> -C $HOME/.dotnetRepeat steps 3 and 4 for all versions you need. Older versions first, newer versions after. Extract them all to the same folder, this won't cause any problems.
Update your shell profile to add the DOTNET_ROOT environment variable and append the path to the .NET executables to the PATH environment variable. For Bash, you will edit "~/.bashrc" to add the following lines at the end.
# dotnet environment variables export DOTNET_ROOT=$HOME/.dotnet export PATH=$PATH:$DOTNET_ROOT:$DOTNET_ROOT/toolsRestart the terminal then run
dotnet --list-sdksanddotnet --list-runtimesto make sure the expected versions were installed.