Allow multiple installations of dotnet. (#17216)

* 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.

Co-authored-by: James Truher <jimtru@microsoft.com>
This commit is contained in:
github-actions[bot]
2022-04-28 17:10:24 -07:00
committed by GitHub
co-authored by James Truher
parent 4f25173d97
commit 8da37f9005
2 changed files with 23 additions and 14 deletions
+21 -12
View File
@@ -1737,6 +1737,7 @@ function Install-Dotnet {
[string]$Channel = $dotnetCLIChannel,
[string]$Version = $dotnetCLIRequiredVersion,
[string]$Quality = $dotnetCLIQuality,
[switch]$RemovePreviousVersion,
[switch]$NoSudo,
[string]$InstallDir,
[string]$AzureFeed,
@@ -1762,20 +1763,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"
}
# 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"
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"
@@ -1809,6 +1812,8 @@ function Install-Dotnet {
$bashArgs += @('-FeedCredential', $FeedCredential)
}
$bashArgs += @('-skipnonversionedfiles')
$bashArgs | Out-String | Write-Verbose -Verbose
Start-NativeExecution {
@@ -1841,6 +1846,8 @@ function Install-Dotnet {
$installArgs += @{FeedCredential = $FeedCredential}
}
$installArgs += @{ SkipNonVersionedFiles = $true }
$installArgs | Out-String | Write-Verbose -Verbose
& ./$installScript @installArgs
@@ -1869,6 +1876,8 @@ function Install-Dotnet {
$psArgs += @('-FeedCredential', $FeedCredential)
}
$psArgs += @('-SkipNonVersionedFiles')
$psArgs | Out-String | Write-Verbose -Verbose
Start-NativeExecution {
+2 -2
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