@@ -52,12 +52,16 @@ if (Get-Command git -ErrorAction SilentlyContinue) {
52
52
53
53
function Install-Dotnet {
54
54
param (
55
- [string []]$Channel
55
+ [string []]$Channel ,
56
+ [switch ]$Runtime
56
57
)
57
58
58
59
$env: DOTNET_INSTALL_DIR = " $PSScriptRoot /.dotnet"
59
60
60
- Write-Host " Installing .NET channels $Channel " - ForegroundColor Green
61
+ $components = if ($Runtime ) { " Runtime " } else { " SDK and Runtime " }
62
+ $components += $Channel -join ' , '
63
+
64
+ Write-Host " Installing .NET $components " - ForegroundColor Green
61
65
62
66
# The install script is platform-specific
63
67
$installScriptExt = if ($script :IsNix ) { " sh" } else { " ps1" }
@@ -70,18 +74,13 @@ function Install-Dotnet {
70
74
# Download and install the different .NET channels
71
75
foreach ($dotnetChannel in $Channel )
72
76
{
73
- Write-Host " `n ### Installing .NET CLI $Version ...`n "
74
-
75
77
if ($script :IsNix ) {
76
78
chmod + x $installScriptPath
77
79
}
78
80
79
- $params = if ($script :IsNix )
80
- {
81
+ $params = if ($script :IsNix ) {
81
82
@ (' -Channel' , $dotnetChannel , ' -InstallDir' , $env: DOTNET_INSTALL_DIR , ' -NoPath' , ' -Verbose' )
82
- }
83
- else
84
- {
83
+ } else {
85
84
@ {
86
85
Channel = $dotnetChannel
87
86
InstallDir = $env: DOTNET_INSTALL_DIR
@@ -90,9 +89,13 @@ function Install-Dotnet {
90
89
}
91
90
}
92
91
93
- & $installScriptPath @params
92
+ # Install just the runtime, not the SDK
93
+ if ($Runtime ) {
94
+ if ($script :IsNix ) { $params += @ (' -Runtime' , ' dotnet' ) }
95
+ else { $params [' Runtime' ] = ' dotnet' }
96
+ }
94
97
95
- Write-Host " `n ### Installation complete for version $Version . "
98
+ exec { & $installScriptPath @params }
96
99
}
97
100
98
101
$env: PATH = $env: DOTNET_INSTALL_DIR + [System.IO.Path ]::PathSeparator + $env: PATH
@@ -107,7 +110,8 @@ task SetupDotNet -Before Clean, Build, TestServerWinPS, TestServerPS7, TestServe
107
110
108
111
if (! (Test-Path $dotnetExePath )) {
109
112
# TODO: Test .NET 5 with PowerShell 7.1
110
- Install-Dotnet - Channel ' 3.1' , ' 5.0' , ' 6.0'
113
+ Install-Dotnet - Channel ' 6.0' # SDK and runtime
114
+ Install-Dotnet - Channel ' 3.1' , ' 5.0' - Runtime # Runtime only
111
115
}
112
116
113
117
# This variable is used internally by 'dotnet' to know where it's installed
@@ -119,6 +123,8 @@ task SetupDotNet -Before Clean, Build, TestServerWinPS, TestServerPS7, TestServe
119
123
$env: DOTNET_INSTALL_DIR = $dotnetExeDir
120
124
}
121
125
126
+ # Disable dev certificate generation
127
+ $env: DOTNET_GENERATE_ASPNET_CERTIFICATE = ' false'
122
128
Write-Host " `n ### Using dotnet v$ ( & $script :dotnetExe -- version) at path $script :dotnetExe `n " - ForegroundColor Green
123
129
}
124
130
0 commit comments