Allow multiple installations of dotnet. (#17141)

* Allow multiple installations of dotnet.

A new flag for removal is now provided, but by default we will add a new version of dotnet.

* Add updated CG manifest.
This commit is contained in:
James Truher [MSFT] 2022-04-12 14:26:52 -07:00 committed by GitHub
parent 4acf6b39d4
commit 9c13c0494f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 25 additions and 16 deletions

View File

@ -1801,6 +1801,7 @@ function Install-Dotnet {
[string]$Channel = $dotnetCLIChannel,
[string]$Version = $dotnetCLIRequiredVersion,
[string]$Quality = $dotnetCLIQuality,
[switch]$RemovePreviousVersion,
[switch]$NoSudo,
[string]$InstallDir,
[string]$AzureFeed,
@ -1821,20 +1822,22 @@ function Install-Dotnet {
if ($environment.IsLinux -or $environment.IsMacOS) {
$wget = Get-Command -Name wget -CommandType Application -TotalCount 1 -ErrorAction Stop
# Uninstall all previous dotnet packages
$uninstallScript = if ($environment.IsLinux -and $environment.IsUbuntu) {
"dotnet-uninstall-debian-packages.sh"
} elseif ($environment.IsMacOS) {
"dotnet-uninstall-pkgs.sh"
}
if ($uninstallScript) {
Start-NativeExecution {
& $wget $uninstallObtainUrl/uninstall/$uninstallScript
Invoke-Expression "$sudo bash ./$uninstallScript"
# Attempt to uninstall previous dotnet packages if requested
if ($RemovePreviousVersion) {
$uninstallScript = if ($environment.IsLinux -and $environment.IsUbuntu) {
"dotnet-uninstall-debian-packages.sh"
} elseif ($environment.IsMacOS) {
"dotnet-uninstall-pkgs.sh"
}
if ($uninstallScript) {
Start-NativeExecution {
& $wget $uninstallObtainUrl/uninstall/$uninstallScript
Invoke-Expression "$sudo bash ./$uninstallScript"
}
} else {
Write-Warning "This script only removes prior versions of dotnet for Ubuntu and OS X"
}
} else {
Write-Warning "This script only removes prior versions of dotnet for Ubuntu and OS X"
}
Write-Verbose -Verbose "Invoking install script"
@ -1868,6 +1871,8 @@ function Install-Dotnet {
$bashArgs += @('-FeedCredential', $FeedCredential)
}
$bashArgs += @('-skipnonversionedfiles')
$bashArgs | Out-String | Write-Verbose -Verbose
Start-NativeExecution {
@ -1898,6 +1903,8 @@ function Install-Dotnet {
$installArgs += @{FeedCredential = $FeedCredential}
}
$installArgs += @{ SkipNonVersionedFiles = $true }
$installArgs | Out-String | Write-Verbose -Verbose
& ./$installScript @installArgs
@ -1926,6 +1933,8 @@ function Install-Dotnet {
$psArgs += @('-FeedCredential', $FeedCredential)
}
$psArgs += @('-SkipNonVersionedFiles')
$psArgs | Out-String | Write-Verbose -Verbose
Start-NativeExecution {

View File

@ -215,7 +215,7 @@
"Type": "nuget",
"Nuget": {
"Name": "Microsoft.Win32.SystemEvents",
"Version": "6.0.0"
"Version": "6.0.1"
}
},
"DevelopmentDependency": false
@ -825,7 +825,7 @@
"Type": "nuget",
"Nuget": {
"Name": "System.Diagnostics.PerformanceCounter",
"Version": "6.0.0"
"Version": "6.0.1"
}
},
"DevelopmentDependency": false
@ -975,7 +975,7 @@
"Type": "nuget",
"Nuget": {
"Name": "System.Net.Http.WinHttpHandler",
"Version": "6.0.0"
"Version": "6.0.1"
}
},
"DevelopmentDependency": false