Add machine-wide .NET install support off Windows

This commit is contained in:
Andrew Arnott 2020-03-30 10:16:19 -06:00
Родитель c2c2ec1858
Коммит cbb60159af
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: FD21E965BEF82456
1 изменённых файлов: 17 добавлений и 20 удалений

Просмотреть файл

@ -83,25 +83,6 @@ Function Install-DotNet($Version, [switch]$Runtime) {
}
}
if ($InstallLocality -eq 'machine') {
if ($IsMacOS -or $IsLinux) {
Write-Error "Installing the .NET Core SDK or runtime at a machine-wide location is only supported by this script on Windows."
exit 1
}
if ($PSCmdlet.ShouldProcess(".NET Core SDK $sdkVersion", "Install")) {
Install-DotNet -Version $sdkVersion
}
$runtimeVersions | Get-Unique |% {
if ($PSCmdlet.ShouldProcess(".NET Core runtime $_", "Install")) {
Install-DotNet -Version $_ -Runtime
}
}
return
}
$switches = @(
'-Architecture','x64'
)
@ -110,7 +91,23 @@ $envVars = @{
'DOTNET_SKIP_FIRST_TIME_EXPERIENCE' = 'true';
}
if ($InstallLocality -eq 'repo') {
if ($InstallLocality -eq 'machine') {
if ($IsWindows) {
if ($PSCmdlet.ShouldProcess(".NET Core SDK $sdkVersion", "Install")) {
Install-DotNet -Version $sdkVersion
}
$runtimeVersions | Get-Unique |% {
if ($PSCmdlet.ShouldProcess(".NET Core runtime $_", "Install")) {
Install-DotNet -Version $_ -Runtime
}
}
return
} else {
$DotNetInstallDir = '/usr/share/dotnet'
}
} elseif ($InstallLocality -eq 'repo') {
$DotNetInstallDir = "$DotNetInstallScriptRoot/.dotnet"
} elseif ($env:AGENT_TOOLSDIRECTORY) {
$DotNetInstallDir = "$env:AGENT_TOOLSDIRECTORY/dotnet"