@@ -32,6 +32,10 @@ Use this to download the latest public preview of a release, if any.
3232.\SDKPatch.ps1 -SDKPath E:\SDK -NupkgsPath E:\NuGet\NuGet.Client\artifacts\nupkgs -SDKChannel 8.0.2xx
3333Use this to download the latest GA version of a release, if any.
3434
35+ . EXAMPLE
36+ .\SDKPatch.ps1 -SDKPath E:\SDK -SDKVersion 9.0.100-preview.2.24157.14
37+ # Use this to download the a specific version of a release.
38+
3539. EXAMPLE
3640.\SDKPatch.ps1 -SDKPath E:\SDK -SDKChannel 8.0.2xx -Quality GA -SkipPatching
3741# Use this to download the latest GA version of a release without patching.
@@ -43,9 +47,10 @@ param(
4347 [string ]$SDKPath ,
4448 [Parameter (Mandatory = $True )]
4549 [string ]$NupkgsPath ,
50+ [string ]$SDKVersion ,
4651 [string ]$SDKChannel ,
4752 [string ]$Quality ,
48- [switch ] $SkipPatching
53+ [switch ]$SkipPatching
4954)
5055# NupkgsPath is the nupkgs folder which contains the latest nupkgs.
5156# Channel name of SDK. Pls refer to https://docs.microsoft.com/en-us/dotnet/core/tools/dotnet-install-script#options
@@ -61,9 +66,16 @@ if(!($SkipPatching)) # Only check the nupkgs path if we're patching
6166 }
6267}
6368
69+ $DownloadSpecificVersion = $false
6470
65- # SDKVersion is the version of dotnet/sdk which NuGet is inserting into.
66- $SDKVersion = " latest"
71+ if (-not ([string ]::IsNullOrEmpty($SDKVersion )))
72+ {
73+ $DownloadSpecificVersion = $true
74+ }
75+ else
76+ {
77+ $SDKVersion = " latest"
78+ }
6779
6880if ([string ]::IsNullOrEmpty($Quality ))
6981{
@@ -398,7 +410,14 @@ if ("Win32NT" -eq [System.Environment]::OSVersion.Platform)
398410 Invoke-WebRequest https:// dot.net/ v1/ dotnet- install.ps1 - OutFile $SDKPath \dotnet- install.ps1
399411 }
400412
401- & $SDKPath \dotnet- install.ps1 - InstallDir $SDKPath - Channel $SDKChannel - Version $SDKVersion - Quality $Quality - NoPath
413+ if ($DownloadSpecificVersion )
414+ {
415+ & $SDKPath \dotnet- install.ps1 - InstallDir $SDKPath - Version $SDKVersion - NoPath
416+ }
417+ else
418+ {
419+ & $SDKPath \dotnet- install.ps1 - InstallDir $SDKPath - Channel $SDKChannel - Version $SDKVersion - Quality $Quality - NoPath
420+ }
402421
403422 $DOTNET = Join-Path - Path $SDKPath - ChildPath ' dotnet.exe'
404423}
@@ -410,7 +429,16 @@ else
410429 }
411430
412431 sudo chmod u+ x $SDKPath / dotnet- install.sh
413- & $SDKPath / dotnet- install.sh - InstallDir $SDKPath - Channel $SDKChannel - Version $SDKVersion - Quality $Quality - NoPath
432+
433+ if ($DownloadSpecificVersion )
434+ {
435+ & $SDKPath / dotnet- install.sh - InstallDir $SDKPath - Version $SDKVersion - NoPath
436+ }
437+ else
438+ {
439+ & $SDKPath / dotnet- install.sh - InstallDir $SDKPath - Channel $SDKChannel - Version $SDKVersion - Quality $Quality - NoPath
440+ }
441+
414442
415443 $DOTNET = Join-Path - Path $SDKPath - ChildPath ' dotnet'
416444}
0 commit comments