Skip to content

Commit

Permalink
Merge pull request #44 from AArnott/linuxMachineSupport
Browse files Browse the repository at this point in the history
Add machine-wide .NET install support off Windows
  • Loading branch information
AArnott authored Mar 30, 2020
2 parents c2c2ec1 + cbb6015 commit 7606283
Showing 1 changed file with 17 additions and 20 deletions.
37 changes: 17 additions & 20 deletions tools/Install-DotNetSdk.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -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'
)
Expand All @@ -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"
Expand Down

0 comments on commit 7606283

Please sign in to comment.