微软.net installer源码解析

微软源码地址  dotnet/install-scripts/blob/master/src/dotnet-install.ps1

代码

   [string]$AzureFeed=”//dotnetcli.azureedge.net/dotnet”,
   [string]$UncachedFeed=”//dotnetcli.blob.core.windows.net/dotnet”,
if ($NoCdn) {
    $AzureFeed = $UncachedFeed
}
 
    if ($Runtime -eq “dotnet”) {
        $VersionFileUrl = “$UncachedFeed/Runtime/$Channel/latest.version”
    }
    elseif ($Runtime -eq “aspnetcore”) {
        $VersionFileUrl = “$UncachedFeed/aspnetcore/Runtime/$Channel/latest.version”
    }
    elseif ($Runtime -eq “windowsdesktop”) {
        $VersionFileUrl = “$UncachedFeed/Runtime/$Channel/latest.version”
    }
    elseif (-not $Runtime) {
        if ($Coherent) {
            $VersionFileUrl = “$UncachedFeed/Sdk/$Channel/latest.coherent.version”
        }
        else {
            $VersionFileUrl = “$UncachedFeed/Sdk/$Channel/latest.version”
        }
    }
获取版本号 
//dotnetcli.azureedge.net/dotnet/Sdk/Current/latest.version
//dotnetcli.azureedge.net/dotnet/Sdk/LTS/latest.version
 
安装包 原始地址
//dotnetcli.azureedge.net/dotnet
cdn 地址
//dotnetcli.blob.core.windows.net/dotnet
 
下载 //dotnetcli.blob.core.windows.net/dotnet/Sdk/版本号/dotnet-sdk-版本号-win-x64.zip
例如
 //dotnetcli.blob.core.windows.net/dotnet/Sdk/3.1.404/dotnet-sdk-3.1.404-win-x64.zip
 
可以获取所有版本的安装包