Skip to content

Instantly share code, notes, and snippets.

@ww898
Last active October 19, 2023 10:20
Show Gist options
  • Save ww898/9e39f4b6df9cfec242bf2d4e170f37a4 to your computer and use it in GitHub Desktop.
Save ww898/9e39f4b6df9cfec242bf2d4e170f37a4 to your computer and use it in GitHub Desktop.
if ($PSVersionTable.PSVersion.Major -lt 3) {
throw "PS Version $($PSVersionTable.PSVersion) is below 3.0."
}
Set-StrictMode -Version Latest
$ErrorActionPreference = [System.Management.Automation.ActionPreference]::Stop
$script:VerbosePreference = "Continue"
$_BaseUrl="https://www.nuget.org/api/v2/package"
function donwload2(
[string]$_Id,
[string]$_Version) {
$_Url="$_BaseUrl/$_Id/$_Version"
$_File="$_Id.$_Version.nupkg"
if (-Not (Test-Path -Path $_File -PathType Leaf)) {
Write-Host $_Url ==> $_File
Invoke-WebRequest -Uri $_Url -OutFile $_File
}
}
function donwload(
[string]$_Id,
[string]$_Version,
[string[]]$_Runtimes) {
ForEach($_Runtime in $_Runtimes) {
$_Url="$_BaseUrl/$_Id.$_Runtime/$_Version"
$_File="$_Id.$_Runtime.$_Version.nupkg"
if (-Not (Test-Path -Path $_File -PathType Leaf)) {
Write-Host $_Url ==> $_File
Invoke-WebRequest -Uri $_Url -OutFile $_File
}
}
}
$_Net60="6.0.23"
$_Net70="7.0.12"
$_NetCoreAppRef="Microsoft.NETCore.App.Ref"
$_NetCoreAppHost="Microsoft.NETCore.App.Host"
$_NetCoreAppRuntime="Microsoft.NETCore.App.Runtime"
$_AspNetCoreAppRef="Microsoft.AspNetCore.App.Ref"
$_AspNetCoreAppRuntime="Microsoft.AspNETCore.App.Runtime"
$_WindowsDesktopAppRef="Microsoft.WindowsDesktop.App.Ref"
$_WindowsDesktopAppRuntime="Microsoft.WindowsDesktop.App.Runtime"
$_Net60Platform=@(
"linux-arm64",
"linux-arm",
"linux-x64",
"linux-musl-arm64",
"linux-musl-arm",
"linux-musl-x64",
"osx-arm64",
"osx-x64",
"win-arm64",
"win-x64",
"win-x86")
$_WindowsNet60Platform=@(
"win-arm64",
"win-x64",
"win-x86")
donwload2 $_NetCoreAppRef $_Net60
donwload2 $_NetCoreAppRef $_Net70
donwload2 $_AspNetCoreAppRef $_Net60
donwload2 $_AspNetCoreAppRef $_Net70
donwload2 $_WindowsDesktopAppRef $_Net60
donwload2 $_WindowsDesktopAppRef $_Net70
donwload $_NetCoreAppHost $_Net60 $_Net60Platform
donwload $_NetCoreAppHost $_Net70 $_Net60Platform
donwload $_NetCoreAppRuntime $_Net60 $_Net60Platform
donwload $_NetCoreAppRuntime $_Net70 $_Net60Platform
donwload $_AspNetCoreAppRuntime $_Net60 $_Net60Platform
donwload $_AspNetCoreAppRuntime $_Net70 $_Net60Platform
donwload $_WindowsDesktopAppRuntime $_Net60 $_WindowsNet60Platform
donwload $_WindowsDesktopAppRuntime $_Net70 $_WindowsNet60Platform
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment