From d46c17c98134516f8da0784d7023a70abe74e7a6 Mon Sep 17 00:00:00 2001 From: Huy Do Date: Thu, 11 May 2023 14:52:19 -0700 Subject: [PATCH] Skip uninstalling other MSVC versions if they are found --- windows/internal/vs2019_install.ps1 | 10 +--------- windows/internal/vs2022_install.ps1 | 10 +--------- 2 files changed, 2 insertions(+), 18 deletions(-) diff --git a/windows/internal/vs2019_install.ps1 b/windows/internal/vs2019_install.ps1 index d586081f9..5574f82eb 100644 --- a/windows/internal/vs2019_install.ps1 +++ b/windows/internal/vs2019_install.ps1 @@ -27,15 +27,7 @@ if (Test-Path "${env:ProgramFiles(x86)}\Microsoft Visual Studio\Installer\vswher echo "Found correctly versioned existing BuildTools installation in $existingPath" exit 0 } - echo "Found existing BuildTools installation in $existingPath" - $VS_UNINSTALL_ARGS = @("uninstall", "--installPath", "`"$existingPath`"", "--quiet","--wait") - $process = Start-Process "${PWD}\vs_installer.exe" -ArgumentList $VS_UNINSTALL_ARGS -NoNewWindow -Wait -PassThru - $exitCode = $process.ExitCode - if (($exitCode -ne 0) -and ($exitCode -ne 3010)) { - echo "Original BuildTools uninstall failed with code $exitCode" - exit 1 - } - echo "Original BuildTools uninstalled" + echo "Found existing BuildTools installation in $existingPath, keeping it" } } diff --git a/windows/internal/vs2022_install.ps1 b/windows/internal/vs2022_install.ps1 index c5e299ca4..fe96e85d2 100644 --- a/windows/internal/vs2022_install.ps1 +++ b/windows/internal/vs2022_install.ps1 @@ -27,15 +27,7 @@ if (Test-Path "${env:ProgramFiles(x86)}\Microsoft Visual Studio\Installer\vswher echo "Found correctly versioned existing BuildTools installation in $existingPath" exit 0 } - echo "Found existing BuildTools installation in $existingPath" - $VS_UNINSTALL_ARGS = @("uninstall", "--installPath", "`"$existingPath`"", "--quiet","--wait") - $process = Start-Process "${PWD}\vs_installer.exe" -ArgumentList $VS_UNINSTALL_ARGS -NoNewWindow -Wait -PassThru - $exitCode = $process.ExitCode - if (($exitCode -ne 0) -and ($exitCode -ne 3010)) { - echo "Original BuildTools uninstall failed with code $exitCode" - exit 1 - } - echo "Original BuildTools uninstalled" + echo "Found existing BuildTools installation in $existingPath, keeping it" } }