@@ -52,12 +52,15 @@ if (Get-Command git -ErrorAction SilentlyContinue) {
5252
5353function Install-Dotnet {
5454 param (
55- [string []]$Channel
55+ [string []]$Channel ,
56+ # Install just the runtime, not the SDK
57+ [switch ]$Runtime
5658 )
5759
5860 $env: DOTNET_INSTALL_DIR = " $PSScriptRoot /.dotnet"
5961
60- Write-Host " Installing .NET channels $Channel " - ForegroundColor Green
62+ $components = if ($Runtime ) { " Runtime" } else { " SDK and Runtime" }
63+ Write-Host " Installing .NET $components $Channel " - ForegroundColor Green
6164
6265 # The install script is platform-specific
6366 $installScriptExt = if ($script :IsNix ) { " sh" } else { " ps1" }
@@ -79,6 +82,7 @@ function Install-Dotnet {
7982 $params = if ($script :IsNix )
8083 {
8184 @ (' -Channel' , $dotnetChannel , ' -InstallDir' , $env: DOTNET_INSTALL_DIR , ' -NoPath' , ' -Verbose' )
85+ if ($Runtime ) { $Params += @ (' -Runtime' , ' dotnet' ) }
8286 }
8387 else
8488 {
@@ -88,8 +92,10 @@ function Install-Dotnet {
8892 NoPath = $true
8993 Verbose = $true
9094 }
95+ if ($Runtime ) { $Params [' Runtime' ] = ' dotnet' }
9196 }
9297
98+
9399 & $installScriptPath @params
94100
95101 Write-Host " `n ### Installation complete for version $Version ."
@@ -107,7 +113,8 @@ task SetupDotNet -Before Clean, Build, TestServerWinPS, TestServerPS7, TestServe
107113
108114 if (! (Test-Path $dotnetExePath )) {
109115 # TODO: Test .NET 5 with PowerShell 7.1
110- Install-Dotnet - Channel ' 3.1' , ' 5.0' , ' 6.0'
116+ Install-Dotnet - Channel ' 6.0' # SDK and runtime
117+ Install-Dotnet - Channel ' 3.1' , ' 5.0' - Runtime # Runtime only
111118 }
112119
113120 # This variable is used internally by 'dotnet' to know where it's installed
0 commit comments