Skip to content

Instantly share code, notes, and snippets.

@jchannon
Last active March 31, 2021 18:13
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jchannon/fabf373bf4c633d0fc5f099303df9ef7 to your computer and use it in GitHub Desktop.
Save jchannon/fabf373bf4c633d0fc5f099303df9ef7 to your computer and use it in GitHub Desktop.
Install .NET Core Side By Side on Linux

dotnet-install

Add the below alias to be used in your terminal

alias dni='curl https://dotnet.microsoft.com/download/dotnet-core/scripts/v1/dotnet-install.sh -o ~/.dotnet/dotnet-install.sh -s | chmod +x ~/.dotnet/dotnet-install.sh | ~/.dotnet/dotnet-install.sh'

Execute the below command to see possible options

dni --help

.NET Tools Installer
Usage: dotnet-install.sh [-c|--channel <CHANNEL>] [-v|--version <VERSION>] [-p|--prefix <DESTINATION>]
       dotnet-install.sh -h|-?|--help

dotnet-install.sh is a simple command line interface for obtaining dotnet cli.

Options:
  -c,--channel <CHANNEL>         Download from the channel specified, Defaults to `LTS`.
      -Channel
          Possible values:
          - Current - most current release
          - LTS - most current supported release
          - 2-part version in a format A.B - represents a specific release
              examples: 2.0; 1.0
          - Branch name
              examples: release/2.0.0; Master
  -v,--version <VERSION>         Use specific VERSION, Defaults to `Latest`.
      -Version
          Possible values:
          - latest - most latest build on specific channel
          - coherent - most latest coherent build on specific channel
              coherent applies only to SDK downloads
          - 3-part version in a format A.B.C - represents specific version of build
              examples: 2.0.0-preview2-006120; 1.1.0
  -i,--install-dir <DIR>             Install under specified location (see Install Location below)
      -InstallDir
  --architecture <ARCHITECTURE>      Architecture of dotnet binaries to be installed, Defaults to `<auto>`.
      --arch,-Architecture,-Arch
          Possible values: x64, arm, and arm64
  --runtime <RUNTIME>                Installs a shared runtime only, without the SDK.
      -Runtime
          Possible values:
          - dotnet     - the Microsoft.NETCore.App shared runtime
          - aspnetcore - the Microsoft.AspNetCore.App shared runtime
  --skip-non-versioned-files         Skips non-versioned files if they already exist, such as the dotnet executable.
      -SkipNonVersionedFiles
  --dry-run,-DryRun                  Do not perform installation. Display download link.
  --no-path, -NoPath                 Do not set PATH for the current process.
  --verbose,-Verbose                 Display diagnostics information.
  --azure-feed,-AzureFeed            Azure feed location. Defaults to https://dotnetcli.azureedge.net/dotnet, This parameter typically is not changed by the user.
  --uncached-feed,-UncachedFeed      Uncached feed location. This parameter typically is not changed by the user.
  --no-cdn,-NoCdn                    Disable downloading from the Azure CDN, and use the uncached feed directly.
  --feed-credential,-FeedCredential  Azure feed shared access token. This parameter typically is not specified.
  --runtime-id                       Installs the .NET Tools for the given platform (use linux-x64 for portable linux).
      -RuntimeId
  -?,--?,-h,--help,-Help             Shows this help message

Obsolete parameters:
  --shared-runtime                   The recommended alternative is '--runtime dotnet'.
      -SharedRuntime                 Installs just the shared runtime bits, not the entire SDK.

Install Location:
  Location is chosen in following order:
    - --install-dir option
    - Environmental variable DOTNET_INSTALL_DIR
    - /home/jonathan/.dotnet

To install a specific version execute the below command

dni -v 2.1.403

Below is what you'll see:

NOTE: You may need to add your user profile location to PATH eg/ export PATH=/home/jonathan/.dotnet:$PATH

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment