This document summarizes how the dotnet-install.sh
script determines the download URLs for .NET SDKs and runtimes.
-
When Used:
This is the preferred and first method for obtaining download URLs, especially for the latest releases and common channels (like LTS/STS). -
How It Works:
- The script constructs a URL of the form:
https://aka.ms/dotnet/<channel>/<quality>/<product>-<os>-<architecture>.tar.gz
<channel>
: e.g., LTS, STS, or a version like 8.0<quality>
: daily, preview (optional, not for LTS/STS)<product>
: dotnet-sdk, dotnet-runtime, aspnetcore-runtime<os>
: linux, linux-musl, osx, freebsd, rhel.6, etc.<architecture>
: x64, arm64, etc.
- The script follows HTTP 301 redirects to the real storage endpoint, resolving the actual artifact location.
- The download link obtained is used to fetch the installer package.
- The script constructs a URL of the form:
If the aka.ms approach fails (e.g., for older versions or if a specific version is requested), the script falls back to constructing direct URLs to known feeds:
-
Feeds Used:
- Public:
https://builds.dotnet.microsoft.com/dotnet
https://ci.dot.net/public
- Custom feeds can be specified via
--azure-feed
or--uncached-feed
.
- Public:
-
Version Determination:
- If
latest
is requested, the script fetches alatest.version
file from the feed to determine the most recent version for a channel. - If a specific version is given, that version is used directly.
- If
-
URL Construction:
The script generates URLs based on the required asset:<feed>/<Type>/<Channel or Version>/<Package File>
- Type: Sdk, Runtime, or aspnetcore/Runtime
- Package File:
- For SDK:
dotnet-sdk-<version>-<os>-<arch>.tar.gz
- For Runtime:
dotnet-runtime-<version>-<os>-<arch>.tar.gz
- For aspnetcore:
aspnetcore-runtime-<version>-<os>-<arch>.tar.gz
- For SDK:
-
Legacy Fallback:
For some very old versions or specific distros, the script constructs "legacy" URLs using different file naming conventions and OS identifiers (e.g.,dotnet-dev-ubuntu.16.04-x64.<version>.tar.gz
).
- Version Selection from global.json:
If aglobal.json
file is provided, the script tries to parse the version from it. - Internal Builds:
If--internal
is specified, it uses internal feeds and requires credentials. - Validation:
The script checks if the required version is already installed and skips downloading if so.
Step | URL Pattern/Source | Used For |
---|---|---|
aka.ms redirect | https://aka.ms/dotnet/<channel>/<quality>/<product>-<os>-<arch>.tar.gz |
Latest/standard downloads |
Feed direct lookup | <feed>/<Type>/<Channel or Version>/<Package File> (see above for specifics) |
Specific/older versions |
Legacy fallback | <feed>/<Type>/<Version>/<legacy file> (OS/distro-specific) |
Ancient distros/versions |
In summary:
The script first attempts to use a short aka.ms URL, following redirects to the official Microsoft blob storage. If that fails or for specific versions, it falls back to constructing direct URLs to dotnet feeds, and as a last resort, uses legacy URL patterns, all determined dynamically based on user input, system architecture, and OS.