Add InstallDir to path if SDK version is already installed (#4843)
* Add InstallDir to path if SDK version is already installed * Make changes based on feedback * Rename "Append" to "Prepend" * Remove check if directory is already in path
This commit is contained in:
parent
4af30914c9
commit
58b0566d9a
1 changed files with 13 additions and 8 deletions
21
scripts/obtain/dotnet-install.ps1
vendored
21
scripts/obtain/dotnet-install.ps1
vendored
|
@ -379,6 +379,17 @@ function DownloadFile([Uri]$Uri, [string]$OutPath) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function Prepend-Sdk-InstallRoot-To-Path([string]$InstallRoot, [string]$BinFolderRelativePath) {
|
||||||
|
$BinPath = Get-Absolute-Path $(Join-Path -Path $InstallRoot -ChildPath $BinFolderRelativePath)
|
||||||
|
if (-Not $NoPath) {
|
||||||
|
Say "Adding to current process PATH: `"$BinPath`". Note: This change will not be visible if PowerShell was run as a child process."
|
||||||
|
$env:path = "$BinPath;" + $env:path
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
Say "Binaries of dotnet can be found in $BinPath"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
$AzureChannel = Get-Azure-Channel-From-Channel -Channel $Channel
|
$AzureChannel = Get-Azure-Channel-From-Channel -Channel $Channel
|
||||||
$CLIArchitecture = Get-CLIArchitecture-From-Architecture $Architecture
|
$CLIArchitecture = Get-CLIArchitecture-From-Architecture $Architecture
|
||||||
$SpecificVersion = Get-Specific-Version-From-Version -AzureFeed $AzureFeed -AzureChannel $AzureChannel -CLIArchitecture $CLIArchitecture -Version $Version
|
$SpecificVersion = Get-Specific-Version-From-Version -AzureFeed $AzureFeed -AzureChannel $AzureChannel -CLIArchitecture $CLIArchitecture -Version $Version
|
||||||
|
@ -400,6 +411,7 @@ $IsSdkInstalled = Is-Dotnet-Package-Installed -InstallRoot $InstallRoot -Relativ
|
||||||
Say-Verbose ".NET SDK installed? $IsSdkInstalled"
|
Say-Verbose ".NET SDK installed? $IsSdkInstalled"
|
||||||
if ($IsSdkInstalled) {
|
if ($IsSdkInstalled) {
|
||||||
Say ".NET SDK version $SpecificVersion is already installed."
|
Say ".NET SDK version $SpecificVersion is already installed."
|
||||||
|
Prepend-Sdk-InstallRoot-To-Path -InstallRoot $InstallRoot -BinFolderRelativePath $BinFolderRelativePath
|
||||||
exit 0
|
exit 0
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -422,14 +434,7 @@ foreach ($DownloadLink in $DownloadLinks) {
|
||||||
Remove-Item $ZipPath
|
Remove-Item $ZipPath
|
||||||
}
|
}
|
||||||
|
|
||||||
$BinPath = Get-Absolute-Path $(Join-Path -Path $InstallRoot -ChildPath $BinFolderRelativePath)
|
Prepend-Sdk-InstallRoot-To-Path -InstallRoot $InstallRoot -BinFolderRelativePath $BinFolderRelativePath
|
||||||
if (-Not $NoPath) {
|
|
||||||
Say "Adding to current process PATH: `"$BinPath`". Note: This change will not be visible if PowerShell was run as a child process."
|
|
||||||
$env:path = "$BinPath;" + $env:path
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
Say "Binaries of dotnet can be found in $BinPath"
|
|
||||||
}
|
|
||||||
|
|
||||||
Say "Installation finished"
|
Say "Installation finished"
|
||||||
exit 0
|
exit 0
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue