@@ -25,17 +25,8 @@ $DotnetSDKVersionRequirements = @{
25
25
$GrpcToolsVersion = ' 2.27.0' # grpc.tools
26
26
$GoogleProtobufToolsVersion = ' 3.11.4' # google.protobuf.tools
27
27
28
- function AddLocalDotnetDirPath {
29
- $LocalDotnetDirPath = if ($IsWindowsEnv ) { " $env: LocalAppData \Microsoft\dotnet" } else { " $env: HOME /.dotnet" }
30
- if (($env: PATH -split [IO.Path ]::PathSeparator) -notcontains $LocalDotnetDirPath ) {
31
- $env: PATH = $LocalDotnetDirPath + [IO.Path ]::PathSeparator + $env: PATH
32
- }
33
- }
34
-
35
28
function Find-Dotnet
36
29
{
37
- AddLocalDotnetDirPath
38
-
39
30
$listSdksOutput = dotnet -- list- sdks
40
31
$installedDotnetSdks = $listSdksOutput | ForEach-Object { $_.Split (" " )[0 ] }
41
32
Write-Log " Detected dotnet SDKs: $ ( $installedDotnetSdks -join ' , ' ) "
@@ -65,7 +56,7 @@ function Install-Dotnet {
65
56
return # Simply return if we find dotnet SDk with the correct version
66
57
} catch { }
67
58
68
- $obtainUrl = " https://raw.githubusercontent.com/dotnet/cli/master/ scripts/obtain "
59
+ $obtainUrl = " https://raw.githubusercontent.com/dotnet/install- scripts/main/src "
69
60
70
61
try {
71
62
$installScript = if ($IsWindowsEnv ) { " dotnet-install.ps1" } else { " dotnet-install.sh" }
@@ -75,13 +66,12 @@ function Install-Dotnet {
75
66
$version = " $majorMinorVersion .$ ( $DotnetSDKVersionRequirements [$majorMinorVersion ].DefaultPatch) "
76
67
Write-Log " Installing dotnet SDK version $version " - Warning
77
68
if ($IsWindowsEnv ) {
78
- & .\$installScript - Channel $Channel - Version $Version
69
+ & .\$installScript - Channel $Channel - Version $Version - InstallDir " $ env: ProgramFiles /dotnet "
79
70
} else {
80
- bash ./ $installScript - c $Channel - v $Version
71
+ bash ./ $installScript - c $Channel - v $Version -- install-dir / usr / share / dotnet
81
72
}
82
73
}
83
74
84
- AddLocalDotnetDirPath
85
75
}
86
76
finally {
87
77
Remove-Item $installScript - Force - ErrorAction SilentlyContinue
0 commit comments