Skip to content

Instantly share code, notes, and snippets.

@baronfel
Created July 2, 2025 20:46
Show Gist options
  • Save baronfel/362af09b9efbc104cf0815cd8f07049f to your computer and use it in GitHub Desktop.
Save baronfel/362af09b9efbc104cf0815cd8f07049f to your computer and use it in GitHub Desktop.
dotnet-install url lookup scheme docs

.NET Install Script URL Lookup Scheme

This document summarizes how the dotnet-install.sh script determines the download URLs for .NET SDKs and runtimes.


1. Primary Lookup: aka.ms Short URL Redirection

  • 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.

2. Fallback: Feed-Based Direct Lookups

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.
  • Version Determination:

    • If latest is requested, the script fetches a latest.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.
  • 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
  • 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).


3. Other Details

  • Version Selection from global.json:
    If a global.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.

Summary Table

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.

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