Skip to content

Commit b3131c0

Browse files
committed
Install only one dotnet SDK
But also install all the necessary runtimes.
1 parent 2905fbb commit b3131c0

File tree

2 files changed

+17
-3
lines changed

2 files changed

+17
-3
lines changed

PowerShellEditorServices.build.ps1

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,12 +52,15 @@ if (Get-Command git -ErrorAction SilentlyContinue) {
5252

5353
function 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

global.json

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"sdk": {
3+
"version": "6.0",
4+
"rollForward": "latestFeature",
5+
"allowPrerelease": true
6+
}
7+
}

0 commit comments

Comments
 (0)