DEV Community

Bambang Purnomosidi D. P. for Zimera Corporation

Posted on • Edited on

4

Multiple .NET SDKs and Runtimes Installation

As a beginner in Microsoft ecosystem, especially under Linux, I found a little bit difficult to get everything works as expected. Last week, I tried to get WebSharper up and run but turns out I can not get it worked. I probably will write about this later. The solution is pretty simple: I need to have .NET SDK - LTS version (3.1.x) while I only have Current version (5.x.x).

So yes, I have to install more than one SDKs and Runtimes. How to do that? dotnet command - AFAIK - can not be used to do that. The answer is dotnet-install scripts - available for Windows and for Bash shell. Using this install script, I can install more than one SDK and Runtimes. Here's how.

Install LTS Version First

  • The argument --install-dir is used to let installer knows the installation directory.
  • The argument -c LTS means that we will install latest version from LTS channel
dotnet-install.sh --install-dir ~/software/dotnet-dev-tools/dotnet-all -c LTS
dotnet-install: Note that the intended use of this script is for Continuous Integration (CI) scenarios, where:
dotnet-install: - The SDK needs to be installed without user interaction and without admin rights.
dotnet-install: - The SDK installation doesn't need to persist across multiple CI runs.
dotnet-install: To set up a development environment or to run apps, use installers rather than this script. Visit https://dotnet.microsoft.com/download to get the installer.

dotnet-install: Downloading primary link https://dotnetcli.azureedge.net/dotnet/Sdk/3.1.413/dotnet-sdk-3.1.413-linux-x64.tar.gz
dotnet-install: Extracting zip from https://dotnetcli.azureedge.net/dotnet/Sdk/3.1.413/dotnet-sdk-3.1.413-linux-x64.tar.gz
dotnet-install: Adding to current process PATH: `/home/bpdp/software/dotnet-dev-tools/dotnet-all`. Note: This change will be visible only when sourcing script.
dotnet-install: Note that the script does not resolve dependencies during installation.
dotnet-install: To check the list of dependencies, go to https://docs.microsoft.com/dotnet/core/install, select your operating system and check the "Dependencies" section.
dotnet-install: Installation finished successfully.
$
Enter fullscreen mode Exit fullscreen mode

Install Current Version

Install current version at the same directory location

$ dotnet-install.sh --install-dir ~/software/dotnet-dev-tools/dotnet-all -c Current
dotnet-install: Note that the intended use of this script is for Continuous Integration (CI) scenarios, where:
dotnet-install: - The SDK needs to be installed without user interaction and without admin rights.
dotnet-install: - The SDK installation doesn't need to persist across multiple CI runs.
dotnet-install: To set up a development environment or to run apps, use installers rather than this script. Visit https://dotnet.microsoft.com/download to get the installer.

dotnet-install: Downloading primary link https://dotnetcli.azureedge.net/dotnet/Sdk/5.0.207/dotnet-sdk-5.0.207-linux-x64.tar.gz
dotnet-install: Extracting zip from https://dotnetcli.azureedge.net/dotnet/Sdk/5.0.207/dotnet-sdk-5.0.207-linux-x64.tar.gz
dotnet-install: Adding to current process PATH: `/home/bpdp/software/dotnet-dev-tools/dotnet-all`. Note: This change will be visible only when sourcing script.
dotnet-install: Note that the script does not resolve dependencies during installation.
dotnet-install: To check the list of dependencies, go to https://docs.microsoft.com/dotnet/core/install, select your operating system and check the "Dependencies" section.
dotnet-install: Installation finished successfully.
$
Enter fullscreen mode Exit fullscreen mode

Install versi beta / RC

Jika ingin melakukan instalasi untuk versi yang belum rilis resmi, gunakan channel sesuai dengan nomor rilis versi beta / RC tersebut. Sebagai contoh, saat penulisan artikel ini, versi beta / RC adalah versi 6.0.100-rc1. Berikut ini adalah tampilan saat instalasi:

$ dotnet-install.sh --install-dir ~/software/dotnet-dev-tools/dotnet-all -c 6.0
dotnet-install: Note that the intended use of this script is for Continuous Integration (CI) scenarios, where:
dotnet-install: - The SDK needs to be installed without user interaction and without admin rights.
dotnet-install: - The SDK installation doesn't need to persist across multiple CI runs.
dotnet-install: To set up a development environment or to run apps, use installers rather than this script. Visit https://dotnet.microsoft.com/download to get the installer.

dotnet-install: Downloading primary link https://dotnetcli.azureedge.net/dotnet/Sdk/6.0.100-rc.1.21458.32/dotnet-sdk-6.0.100-rc.1.21458.32-linux-x64.tar.gz
dotnet-install: Extracting zip from https://dotnetcli.azureedge.net/dotnet/Sdk/6.0.100-rc.1.21458.32/dotnet-sdk-6.0.100-rc.1.21458.32-linux-x64.tar.gz
dotnet-install: Adding to current process PATH: `/home/bpdp/software/dotnet-dev-tools/dotnet-all`. Note: This change will be visible only when sourcing script.
dotnet-install: Note that the script does not resolve dependencies during installation.
dotnet-install: To check the list of dependencies, go to https://docs.microsoft.com/dotnet/core/install, select your operating system and check the "Dependencies" section.
dotnet-install: Installation finished successfully.
$
Enter fullscreen mode Exit fullscreen mode

Innstallation Check

Now, when we use --info as dotnet CLI argument, we will have those 2 SDKs and 2 Runtimes already installed:

$ dotnet --info
.NET SDK (reflecting any global.json):
 Version:   6.0.100-rc.1.21458.32
 Commit:    d7c22323c4

Runtime Environment:
 OS Name:     devuan
 OS Version:  4
 OS Platform: Linux
 RID:         linux-x64
 Base Path:   /home/bpdp/software/dotnet-dev-tools/dotnet-all/sdk/6.0.100-rc.1.21458.32/

Host (useful for support):
  Version: 6.0.0-rc.1.21451.13
  Commit:  d7619cd4b1

.NET SDKs installed:
  3.1.413 [/home/bpdp/software/dotnet-dev-tools/dotnet-all/sdk]
  5.0.207 [/home/bpdp/software/dotnet-dev-tools/dotnet-all/sdk]
  6.0.100-rc.1.21458.32 [/home/bpdp/software/dotnet-dev-tools/dotnet-all/sdk]

.NET runtimes installed:
  Microsoft.AspNetCore.App 3.1.19 [/home/bpdp/software/dotnet-dev-tools/dotnet-all/shared/Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 5.0.10 [/home/bpdp/software/dotnet-dev-tools/dotnet-all/shared/Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 6.0.0-rc.1.21452.15 [/home/bpdp/software/dotnet-dev-tools/dotnet-all/shared/Microsoft.AspNetCore.App]
  Microsoft.NETCore.App 3.1.19 [/home/bpdp/software/dotnet-dev-tools/dotnet-all/shared/Microsoft.NETCore.App]
  Microsoft.NETCore.App 5.0.10 [/home/bpdp/software/dotnet-dev-tools/dotnet-all/shared/Microsoft.NETCore.App]
  Microsoft.NETCore.App 6.0.0-rc.1.21451.13 [/home/bpdp/software/dotnet-dev-tools/dotnet-all/shared/Microsoft.NETCore.App]

To install additional .NET runtimes or SDKs:
  https://aka.ms/dotnet-download
$
Enter fullscreen mode Exit fullscreen mode

Now, we can use LTS, Current, and beta / RC version altogether. Enjoy!

Heroku

This site is built on Heroku

Join the ranks of developers at Salesforce, Airbase, DEV, and more who deploy their mission critical applications on Heroku. Sign up today and launch your first app!

Get Started

Top comments (0)

Image of Docusign

🛠️ Bring your solution into Docusign. Reach over 1.6M customers.

Docusign is now extensible. Overcome challenges with disconnected products and inaccessible data by bringing your solutions into Docusign and publishing to 1.6M customers in the App Center.

Learn more